I created a text editor in C# and I use a special file extension for the XML file that my program uses. When I use “Open With…” from the Windows context menu, my program doesn’t read the file and I get an error.
How do I fix this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In your
Main()method, you need to capture the file name:Then you’ll need to pass
fileNameto the code that opens the file. How you do that is up to you.If your
Main()method has no parameters, just add thestring args[]parameter and the runtime will take care of populating the array with the commandline parameters.If you are already doing that, then this is probably a SuperUser question.