C# HELP...here...about the popup file
-
Hi programmer, Im doing a project, my question is " How to allow the file to popup when the button is click." The file is in (C:\Documents and Settings\Lohsk\My Documents\Introduction.txt). Can someone help me :confused:.The program must written in c#.
-
Hi programmer, Im doing a project, my question is " How to allow the file to popup when the button is click." The file is in (C:\Documents and Settings\Lohsk\My Documents\Introduction.txt). Can someone help me :confused:.The program must written in c#.
Process.Start will open your text file in the default program ( probably notepad ). You can use File.ReadAllText to read it and display it yourself.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Hi programmer, Im doing a project, my question is " How to allow the file to popup when the button is click." The file is in (C:\Documents and Settings\Lohsk\My Documents\Introduction.txt). Can someone help me :confused:.The program must written in c#.
try this:- private void button1_Click(object sender, EventArgs e) { try { System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = @"C:\Documents and Settings\Lohsk\My Documents\Introduction.txt"; process.StartInfo.ErrorDialog = true; process.Start(); } catch (Exception err) { MessageBox.Show(err.ToString()); } }
-
Hi programmer, Im doing a project, my question is " How to allow the file to popup when the button is click." The file is in (C:\Documents and Settings\Lohsk\My Documents\Introduction.txt). Can someone help me :confused:.The program must written in c#.