954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Open files on double click

Greetings:
I developed a simple application for text encryption, i managed to register the new extension, my question is how to open this files from outside the program?(when you double click on them), i know that you need to pass some parameters to the main method but im not sure how,
If possible could you post a sample code or a snippet?.
Thanks in advance

ROGENATOR
Newbie Poster
17 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

add "string[] args" to your Main method

will tell you like what the filepath to the file that was opened is, or if you open the program from command prompt it will tell you the parameters the user used.
and it would show the path of a file if you dragged it onto your program

static void Main(string[] args) 
		{
		
			Application.Run(new Form1());

		}
plazmo
Posting Whiz in Training
207 posts since Aug 2005
Reputation Points: 23
Solved Threads: 16
 

Greeting:
Thanks, that was what i was missing

ROGENATOR
Newbie Poster
17 posts since Sep 2005
Reputation Points: 11
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You