Click here to Skip to main content
15,893,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I have an application where i want to save the current state of some objects to a file and then i want the application that file to be assosiated with my application so that when i double click on that file, my app will open and read the info from that file to retore the state.

Currently i'm simply using the XmlSerializer to serialize a wrapper object and save it to a xml file on my HDD.

Any suggestions as to how i would be able to use that created file to open my app?

Sorry, i'm pretty new in the c# environment and I'm not sure how to search for something like this.

Thanks
Posted

OK :)
Try to change your output extension
from .XML to, for example, .YourAppSettings
and associate the new extension with your application by Explorer :)
 
Share this answer
 
You could use a shortcut
to start your app with an XML file as parameter... :)
 
Share this answer
 
Thanks alot it can help me for now but i cant do that for every session i save - eventually there will be many.
I want the app to work like a word doc, for example, where you open the .doc file and it opens MS Word. I will create my own file extension e.g. *.pop
 
Share this answer
 
Thanks!
I didn't know that when you open a file with your c# app, the filepath is passed to the application as a parameter.
Got that sorted out thanks!

Now I would like to know how to change my Program and Access Defaults programmatically when i run the app for the first time or install it...
 
Share this answer
 
v2
Can you decrypt this[^] ? :)
 
Share this answer
 
i get the basic idea - basically just adding the extention and description etc to HKEY_CLASSES_ROOT in the registry - altough c++ is way before my time so the syntax screws me around a little.
I see you can also do this when publishing a clickOnce app (Publish>Options>File Associations). that will be fine for me for now.

cool. thanks for your replies
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900