Question open text files with my notepad...

DeathStar13

New member
Joined
May 19, 2012
Messages
1
Programming Experience
1-3
hi everybody,
i created my own notepad and it can open files with openFileDialog.
but i also want that if i select a text file, and i say "open with" my notepad... that my notepad will show that text file...

so not with openFileDialog or someting like that...

Thanks!
 
When you use Open With in Windows Explorer and select your program, it is equivalent to you opening a Command window and typing the path of your app followed by the path of the data file. In both cases, your app will be executed and the path of the data file will be passed as a commandline argument. You can process that commandline argument in one of two main ways:

1. Handle the Startup event of the application (and StartupNextInstance for single-instance apps) and access the commandline arguments via the 'e' parameter.
2. Call Environment.GetCommandLineArgs anywhere in your app, e.g. in the Load event handler of the main form.
 
Back
Top