W
walter hausser
Hi everyone!
I have the following problem:
My program saves data as .xml files. I want the following: When a user
right-clicks on a .xml file (in Windows XP), and he chooses "Open
with..." and then he chooses my program, the program should load itself
and should open exactly this x.xml file.
Up to now, I have only a static version; i.e. the method MainForm_load
opens every time the same file, e.g. "C:\test.xml". Now I want to
replace "C:\test.xml" with the file that the user has chosen by
right-clicking.
The code for the static file is:
private void MainForm_Load(object sender, System.EventArgs e)
{
Stream myStream = File.OpenRead("C:\\test.xml");
XmlSerializer s = new XmlSerializer (typeof(storage));
objstorage = (storage)s.Deserialize(myStream);
myStream.Close();
}
PS: Just for clarity one more time: Of course there is an option to
select and open xml files inside the program. But for this, you have
first to run the program. (Also, you don't need to run Winamp first, and
then you can open a mp3 file; but you can simply double-click on the
desired mp3 file.)
I hope you are able to help me.
Thanks
Walter
I have the following problem:
My program saves data as .xml files. I want the following: When a user
right-clicks on a .xml file (in Windows XP), and he chooses "Open
with..." and then he chooses my program, the program should load itself
and should open exactly this x.xml file.
Up to now, I have only a static version; i.e. the method MainForm_load
opens every time the same file, e.g. "C:\test.xml". Now I want to
replace "C:\test.xml" with the file that the user has chosen by
right-clicking.
The code for the static file is:
private void MainForm_Load(object sender, System.EventArgs e)
{
Stream myStream = File.OpenRead("C:\\test.xml");
XmlSerializer s = new XmlSerializer (typeof(storage));
objstorage = (storage)s.Deserialize(myStream);
myStream.Close();
}
PS: Just for clarity one more time: Of course there is an option to
select and open xml files inside the program. But for this, you have
first to run the program. (Also, you don't need to run Winamp first, and
then you can open a mp3 file; but you can simply double-click on the
desired mp3 file.)
I hope you are able to help me.
Thanks
Walter