|
When I am serializing a class Contrains only static variables by creating instance. the static variables are not serializing. is there any way to save the satatic variables ?
Plz help me................
B V KIRAN KUMAR
|
|
|
|
|
I just checked ( because someone asked this in the last day, and I wanted to see if it was you ), you know you've never once responded to anyone who helps you ?
Serialisation saves a class instance, by definition it does not store static variables. You'd need to create instance variables and populate them before serialising and move them to the static values after reloading.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thank u for ur response. thank you.
B V KIRAN KUMAR
|
|
|
|
|
|
What is your question ? You found help, but you have a problem ? What problem ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I need some guidance here .
I have created a windows App that will display all the details regadring my internet connections in text boxes.
For example i have three connections.They are displayed in a listbox.
When i select any one of them, their details SubnetMAsk,DNS1,Dns2 etc will be displayed in the text boxes.Everything works fine till here.
But now my problem starts.
I want this detils to be applied to my computer so that i can switch my internet connections when i click on a button "Switch".
I have no idea how to do this.Any guidance or links will be most welcome.
Thanking You
|
|
|
|
|
hi
i have some question that not solve
1. how can i zip file in c# code ?
2. how can i pick more than one record in Datagrid ?
3. how can i get my program path ?
4. how can i do that my progran open only one time ?
5. is it be right to move to VS2008 from VS2005 ?
i need help in C# & VS2005
thank's alot for any help
|
|
|
|
|
answer 1[^]
I have no idea what question 2 means
Application.StartupPath will give you the path without the exe name, I forget the Application. property that gives you the full path
Answer 4[^]
Question 5 is ridiculous. Is it right based on what criteria ? What is your concern ? Do you want to move a project or just start using 2008 ?
2 questions that make no sense, and 3 that were answered in seconds by google ( well, one was so easy I just answered it, but google would have too ). Hardly 'unsolvable'.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'll give Question 2 a go
Create an ArrayList called SelectedRowsList for your rows,records??.
Then on MouseClick on your Datagrid.
if (Datagrid.RowCount > 0 && Datagrid.CurrentRow != null)<br />
{<br />
selectedrow = Datagrid.CurrentCellAddress.Y;<br />
SelectedRowsList.Add(selectedrow);<br />
}
I think this is what you asked... hope it helps
A craft is an enemy if not well learned.
|
|
|
|
|
3. Application.ExecutablePath
4. search CodeProject for "application singleton"
whatever the solution is, the application will be launched a second time, but it will be able
to signal that (and optionally pass the new command line) to the first instance.
|
|
|
|
|
I saw many examples over the net like
<br />
[Serializable]<br />
public class Customer<br />
{<br />
}<br />
What is the meaning of the Serializable...? What it will do..?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Since nobody is around to give you a better explanation, I'll give you a real light view:
It basically means that the object/data can be persisted beyond the lifetime of your application - that is, saved. Written down somewhere. Like on disk.
The real meaning is actually more abstract than that, but this is a pretty good start.
Do some searching in Google or in the MS SDK documentation, you'll see a lot more on it.
|
|
|
|
|
|
JoeRip,
Thanks for your reply. But I can't get the line
"It basically means that the object/data can be persisted beyond the lifetime of your application - that is, saved. Written down somewhere. Like on disk."
If My application is closed then how would I know the object is persist or not...? If persist then what is the name of it and how can I access it...?
And when I set objCustomer=null then it automatically destroyed and if I can't do this the GC will automatically clear it from memory....
Please reply....
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
modified on Saturday, December 15, 2007 3:33:31 AM
|
|
|
|
|
You have to write the code to serialize the object to a file on disk, or some other data store. It doesn't happen automatically.
|
|
|
|
|
You didn't ask how to do it, you asked what it meant.
If you follow the link I sent you, it's all explained. Some of the existing .NET / CLR classes are already serializable, meaning the work has been done to allow you to serialize them. For your own objects, there is plenty of information in MSDN on how to write specific serialization code. Start at the link I gave you.
|
|
|
|
|
I have 4 processes that running on some machine - 3 of them are exe files and one of them is some Dll.
I want to find the path of those 4 file - i know the process name of each of those process.
How can i find the path ?
Thanks for the help.
|
|
|
|
|
You can use Process.GetProcessesByName("processName") method to get the instance of process class associated with the process started by the executable you are interested in. After that use the MainModule property of process class to retrieve the executable path.
|
|
|
|
|
Is there a generally accepted method for detecting the launch of a third party exe?
I can think of a few methods, but I'm not sure what is the generally accepted method:
1. get the location of the exe on disk, and use a FileSystemWatcher on it (haven't tested this yet)
2. scan the process list periodically, watching to see if the process name in question shows up
Is there a better way?
|
|
|
|
|
If you know path of the executable file you can use FileSystemWatcher to monitor start. However, you can detect creation and deletion of any process using WMI.
|
|
|
|
|
You can use WMI and the classes in the System.Management namespace to do this.
Th FileSystemWatcher will do you no good in this case because the .EXE will not change when you launch it.
|
|
|
|
|
1. I did ask if anybody knew about what the generally accepted way to do this was... any comment there?
2. The method you recommend - could you at least toss a few methods or properties my way? "You can use WMI and the System.Management namespace to do this... see the XXXX method, for example." would have been great.
Unfortunately, what I got was just a few steps from "You can do this with code!" or "There's a method hidden in DirectX that does this, but I'm not going to tell you it's name. Have fun searching!"
|
|
|
|
|
|
I'm flattered that you thought I would think to search for "WMI process notification" based on the terms "What's the best way to detect the launch of an exe." I accept your pronouncement of my wisdom. I'm feeling better already...
Admit that you failed to answer the "best practices" core of my question. Admit it!!
Oh, and thanks for the links.
|
|
|
|
|
Hey, that "Thanks" may have looked snarkey, but it wasn't meant to be. Truly, actually, thanks for the info. It looks like this is exactly what I want.
Is there a more appropriate place to ask my "Best Practices" question?
|
|
|
|