hello,
I am Anas Siddiqui, i am developing a text editor and it works properly. and its files are open very easily by open file dialog. but when i am click directly its file icon to open that file, the file opens in my text editor by the content of my file is not loaded.......
Loading

Suthish NairRank #92 · 22.8K reputationPosted Apr 8, 2011, 8:09 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 8, 2011, 12:25 PM EDT
Are you processing the arguments in the command line? If you don't know what that is then I assume your program is not doing that. Try doing this. In the Program.cs file add "string[] args" to the Main so it looks like:
static void Main(string[] args)
Then (just for test purposes) add the following lines to the beginning of Main:if (args.Length > 0)
MessageBox.Show(args[0]);
Then open a file by "click directly its file icon to open that file". If that executers the modified version then you should see the filename in the message box. There will probably be something more but I am not sure. So then look for articles and such about hows to process the command line.
FroglegRank #1,020 · 1.9K reputationPosted Apr 8, 2011, 3:23 PM EDT
You will have to check the file type to make sure it is a text file
Sam HobbsRank #107 · 20.5K reputationPosted Apr 8, 2011, 3:47 PM EDT
FroglegRank #1,020 · 1.9K reputationPosted Apr 8, 2011, 3:51 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 8, 2011, 6:51 PM EDT
What happened? Nothing! Why did nothing happen? Because the build saw that the date on the exe is past the date of the code modification. Got it? It is a timezone thing. I said "I happen to be about 19 hours behind you". Got it? The exe in your zip file that you built had a file date that was in the future for me at the moment I modified the code. So I am just having a bit of fun here; I hope you enjoy the humor. Seriously, though, there might be someone in the future that might not be so quick to catch on. It's not big problem and a simple quick rebuild all solves the problem but some people might be confused.
FroglegRank #1,020 · 1.9K reputationPosted Apr 8, 2011, 9:04 PM EDT
When i read your post I rechecked the application and it worked Ok, so I was at a loss with your problem
By the way it's gonna rain today
Sam HobbsRank #107 · 20.5K reputationPosted Apr 8, 2011, 9:09 PM EDT
CrishRank #1,487 · 1.1K reputationPosted Apr 9, 2011, 1:20 AM EDT
The Example is solution of icon click.
string fileName = "text.txt";
string filePath = Server.MapPath("~/" + fileName);
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" + fileName);
Response.ContentType = "application/octet-stream";
Response.WriteFile(filePath);
Response.Flush();
Response.End();