Hi!
I have an application made in c# which is like a notepad. I was wondering how can I set that when the user in windows right clicks a txt file and selects "open with..." and then my app it loads the file in it. Now it just opens the application without any text in it.
Any ideas?
Loading
Aleksandar IlioskiPosted Mar 22, 2009, 9:13 PM
When you try to open your program with (open with at some file), you pass two arguments to your program.
1-st one is path of your program, and 2-nd is path of that file...
So what you have to do is to make Open metod.. something like this:
public void Open (string path)
{
ritchTextBox.LoadFile(path);// and when you call that metod you will pass that second argument( path of that .txt file)
}
and in onLoad event call that metod something like this:
string path = Environment
.GetCommandLineArgs()[1] Open(path);Aleksandar IlioskiPosted Mar 24, 2009, 8:35 PM
blagoje ivanovicPosted Mar 23, 2009, 6:49 AM
One more thing: How can I make in load event that if the extension of the document is .doc then it opens it as a .doc file and if it's .rtf it opens it as a .rtf and so on?
Thanks in advance.