Hi, having a problem with streamreader im not to sure how to solve. I have made a text editor, now what i'd like it to do is when i click a textfile in windows - the program opens automatically and views it, but i cant seem to make the path and filename appear in the titlebar of the program. Now this works fine with filestream and by using filestream file = new filestream(etc) and then just file.Name.ToString(); but this option is not included within the streamreader.
I'm guessing i need to use Environment.Commandline to get the args on opening and then somehow strip the result which is: "textviewer.exe" "C:\textfile.tkst", by using substring or indexof. But im having a hard time making this work, if anyone could give me an working example it would be very much appreciated. Following example is how i open the file:
Form1 frm = new Form1();
System.IO.StreamReader myFile = new System.IO.StreamReader(args[0],System.Text.Encoding.Default);
string line = "";
line = myFile.ReadToEnd();