|
Thanks, Heath, Marc! Serialization is exactly what I wanted.
I'm having this problem using it:
[Serializable]
public class Superclass ...
[Serializable]
public class Subclass: Superclass ...
{
[Nonserializable]
private Bitmap bigThing = bitmap ("bigfile.bmp");
}
...
//mySubclassObject already exists
IFormatter formatter = new BinaryFormatter();
mySubclassObject = (visualBoard) formatter.Deserialize(s);
So when I do this, I successfully load the parts I want . . . but the bitmap is of course not loaded, and mySubclassObject is not displayable. Before I start this chunk of code, it knows where the bitmap is.
I also tried moving this deserialization code into a method of Subclass, so I could then remind it where the bitmap is, but then I can't deserialize into "this" because "this" is read-only.
Thanks for all--
|
|
|
|
|
Hi,
I have a flat file at an http intranet server location. I need to access it and download it using a console application. Any ideas? Please email me at mrinmayee.k@gmail.com
Thanks
Minu
|
|
|
|
|
You can either use the WebClient.DownloadFile method, or - for more control - a pair of HttpWebRequest and HttpWebResponse classes. The likely namespace to search for these types of classes is System.Net , and I suggest you explore[^] the namespace. The method and classes I mention above also have samples you can read.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Lets say I have a visual control with several properties set during design that will affect the display of the control. How do I ensure that the control is repainted after the properties are set in InitializeComponent? Is there a way to determine the order that the control's properties are initialized in InitializeComponent so that I can ensure that the last initialization causes a repaint? Or is there an event that I can overrride that fires when the initialization is complete?
|
|
|
|
|
terrier_jack wrote:
How do I ensure that the control is repainted after the properties are set in InitializeComponent?
I believe that is the purpose of the ISupportInitialize interface--it lets other things do all the property setup, then when the EndInit() method is called, your class can do whatever it needs to configure itself based on those property values.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Why can't you do as this:
Public MyControl()<br />
{<br />
InitializeComponents();<br />
this.refresh();<br />
}
As it will be refreshed after the call of the init() is returned and all the initialization is complete.
Assuming that your visual properties will be user in the Overrode OnPaint Method .
|
|
|
|
|
Hi every body!
Do you know any control (.net) help designing HTML on desktop application?
It is like WYGIWYS, but use for desktop app!
THanks!
|
|
|
|
|
You can use the WebBrowser control just as you would for browsing in a Windows Forms application, but for a WYSIWIG (the more common acronym, BTW) editor you set WebBrowser.Document.designMode to "On" (upper-case "O" is important).
There are lots of articles here on Code Project about how to make this work, since there are plenty of issues you have to address (like only setting this when the document is finished loading). I recommend you search this site (using the text box below the logo on every page) for "WebBrowser designMode" for a list of articles.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am unable to connect the client which is written in Managed code (C# .Net) with server UnManaged code(VC++ 6.0). Can any of u plz help me in this regard.
Shashidhar
|
|
|
|
|
|
I depends entirely on what the server application is expecting. What kind of connection is the server expecting? RPC? Socket? What port number? Without knowing the details of the server, it's impossible to tell you what to do...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I've a client-server application where clients ans servers connect with config file.
<br />
RemotingConfiguration.Configure("file.xml");<br />
m_DataMgrConnexion = (IDataManager) RemotingHelper.GetObj(typeof(IDataManager));<br />
RemotingHelper is a class written by Ingo Rammer (see : http://www.thinktecture.com/Resources/RemotingFAQ/USEINTERFACESWITHCONFIGFILES.html [^]
The problem is that I can't disconnect client using config file (in fact, I would like to unregister the channel because I need to disconnect and reconnect with an other config file)
Is there a way to unregister the channel using this type of connection ?
I can't register by another way because i'm using events and config file connection is the best way to go
thks,
sokette
|
|
|
|
|
First of all, if you have questions about RemotingHelper you should contact Ingo Rammer. This forum is for general questions, and specific questions about articles on this site need to go at the bottom of the article pages.
Second, all his RemotingHelper does is encapsulate functionality that already exists. I would recommend using either ildasm.exe from the .NET Framework SDK or .NET Reflector[^] to view how his implementation works.
When you use RemotingConfiguration.Configure , you need to get references where you can. To unregister a channel, you should try using ChannelServices.GetChannel and pass that returned reference to ChannelServices.UnregisterChannel . You should be able to pass the MarshalByRefObject -derived remoting object to RemotingServices.Disconnect depending on its construction.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thks a lot for your answer;
I've try your solution. I still have a problem ...
connect :
<br />
RemotingConfiguration.Configure("file.config");<br />
m_DataMgrConnexion = (IDataManager) RemotingHelper.GetObj(typeof(IDataManager));<br />
disconnect :
<br />
ChannelServices.UnregisterChannel(ChannelServices.GetChannel("ClientChannel"));<br />
==> If I connect and disonnect Ok, but if I try to reconnect after connecting and disconnecting, I have the following error :
RemotingException : Remoting configuration failed with the exception System.Runtime.Remoting.RemotingException: Attempt to redirect activation of type 'IDataMgrRemote.IDataManager, IDataMgrRemote' which is already redirected.
at System.Runtime.Remoting.RemotingConfigInfo.AddWellKnownClientType(WellKnownClientTypeEntry entry)....
Then, I changed my disconnect method
<br />
ChannelServices.UnregisterChannel(ChannelServices.GetChannel("ClientChannel"));<br />
RemotingServices.Disconnect((IDataManager)m_DataMgrConnexion);<br />
but I've another error when I try to disconnect : Cannot call disconnect on a proxy.
Thks for u help
|
|
|
|
|
Hi, I'm making a graphic program, and I would like to use a Property Grid controls in it. Does anybode know any good tutorial on these controls?
|
|
|
|
|
Read Enhancing Design-Time Support[^] in the .NET Framework SDK. The PropertyGrid makes use of TypeConverter derivatives, UITypeEditor derivatives, ICustomTypeDescriptor implementations, and more you can find in the System.ComponentModel namespace and many of the *.Design namespaces to control what you see, from what properties are exposed (or even created for design-time only) to how certain properties are editor (like enumerations or collections).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
When running the following code
try<br />
{<br />
System.Net.IPAddress multicastaddress = System.Net.IPAddress.Parse("224.0.0.1");<br />
udpclient.JoinMulticastGroup(multicastaddress, 50); <br />
}<br />
catch ( SocketException e )<br />
{<br />
Console.WriteLine( e.ToString());<br />
}
On XP with service pack 2, I am recieving the following excetion :
"An invalid argument was supplied"
while the same code runs perfectly good on windows 2000 computers.
Any idea ?
Thanks in advance, Udi Raz
|
|
|
|
|
|
Thanks but didn't help much.
"System.Net.Sockets.SocketException: An invalid argument was supplied
at System.Net.Sockets.Socket.setMulticastOption(SocketOptionName optionName, MulticastOption MR)
at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Object optionValue)
at System.Net.Sockets.UdpClient.JoinMulticastGroup(IPAddress multicastAddr)
at DVP.Do.AddMsgToLog(String msg, Int32 port, String ip) in c:\\dev\\net\\core\\dvp\\dvp.cs:line 664"
I tried to remove the FireWall, but still nothing. Maybe there is a security problem, maybe the XP does not allow communication through the port ????
Thanks again, Udi
|
|
|
|
|
Hello All,
I have created a helpdesk application in ASP.NET along with C#. Now i want a windows service to be run on server
I wnt a functionality in which if a problem is submitted at 10.00 the support person can set up an alarm and there must also be an automated alarm
to warn the support person to handle the problem before 2 hours of its subscripotion so at 12.00 if the problem is not solved it sends a mail to higher level support staff
now i wnt help from your side i have created a basic service. but tell me how to start of with this.
Waiting for a quick reply
|
|
|
|
|
You'll want to extend the ServiceBase class that is documented[^] in the .NET Framework SDK. If you're using VS.NET, create a new Windows Service project. With your service open (you'll see a blank, yellow background (by default)), right click and select "Create Installer". This will add an installer project that'll let you easily install your service using the installutil.exe application that's installed into %windir%\Microsoft.NET\Framework\v[FrameworkVersion], where [FrameworkVersion] is the version of the runtime you want to use to install the service (any should work so long as you don't use obsolete or new types and members).
To handle the time issue, you'll need to use one of the various Timer classes in the .NET Framework. There are 3 of them and each is suited for different tasks (though with the right coding any will work).
Consider this, however: such a scheduler already exists on your system: the Task Scheduler. In your control panel you'll find this virtual folder which you can create tasks in to run certain programs (like a "beep" application for an alarm). You can also access this programmatically using the native ITaskScheduler[^] interface. It would be easier to just write a native application to use this COM interface and it's associated class, represented by CLSID_CTaskScheduler . You could interop these interfaces in managed code, but you'll either have to create them yourself or create a dummy IDL file to forward-declare the necessary interfaces, compile it with midl.exe, then create an interop assembly using tlbimp.exe that ships with the .NET Framework SDK (that VS.NET installs by default).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello Stewart thnks alot for replying.
I am a bit new to VS.NET so thts why i think the solution that you have given may be is a bit complex of using IDL and rather i can do it using a thread in Windows service which continuosly checks up records in database and if any problem time is over it will insert a new record into alert table so whenever user opens the inbox he will have a new mail in tht alert inbox.
If any other effective solution then tell me
Thnaks Alot For Replying
|
|
|
|
|
It's not as easy as you think. Are you going to take into account resiliency (so that if the computer goes down either gracefully or not, when it comes back up the timer accounts for lost time)? What about security (what account does the service NEED to run under, i.e. what are the minimum privileges required)?
Again, this is a simple solution if you write it using native C++. The steps I outlined are only necessary if you want to do this in native code. If you're doing this as part of a managed application, you could write the implementation in native code and then P/Invoke a simple function exported from your native DLL from your managed application:
sched.dll (native)
ScheduleTask(TaskStruct task);
app.exe (managed)
P/Invoke ScheduleTask;
Declare TaskStruct;
If you are going to handle resiliency and security yourself (which the Task Scheduler already does), then you should look at the Timer classes in the .NET Framework I mentioned in my previous post. You can find these in your .NET Framework SDK that VS.NET installs by default (just click the Help menu, select Index, then type "Timer class". These are also available online at the following URLs:
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
How to Create a Flolder on a server where my database reside?
Which types of rights i required for creating folder?
Perrak shah
|
|
|
|
|
This is an open-ended question. You do not specify how you have access to the server (UNC, HTTP, FTP, etc.) or if you even have security rights to create folders. If this was on a network share, you'd simply use Directory.CreateDirectory("\\server\share\new directory") . If you don't have the necessary access rights, an UnauthorizedAccessException will be thrown. Over HTTP, FTP, etc., protocols, the method is different for each one.
Please be specific in your requests.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|