Monday, 15 March 2010

c# open notepad and write in other computer -


I have a project and I want to get the buyer's receipt and write it on notepad but my problem is when I My application on other computers is not opening the Notepad and clicking the button when nothing happens

  var path = path.combin (Directory.GetCurrentDirectory (), "\\ Receipt. Txt "); (StreamWriter w = New StreamWriter (path)) {string x = label1.Text.Replace ("", string.Empty); String x2 = label 2. Lesson Change ("", string.Empty); String x3 = label 3 Lesson Change ("", string.Empty); String x4 = label4.Text.Replace ("", string.Empty); String x5 = label 5 text Change ("", string.Empty); W.Write ("********************************************************************; W.Write ("\ r \ n" + "\ r \ n" + "********************* + "\ R \ n"); W.Write (x + "\ r \ n", true); W.Write (x2 + "\ r \ n", true); W.Write (x3 + "\ r \ n", true); W.Write (x4 + "\ r \ n", true); W.Write (x5 + "\ r \ n", true); W.Write ("\ r \ n" + "************************************************************** **************************************************************************************************** ******* r \ n "); W.Write ("Price of item quantity" + "\ r \ n"); (Int xx = 0; xx & lt; listbox1.Items.Count; xx ++) {w.Write (listBox1.Items [xx]. ToString () + "\ r \ n"); } W.Write ("_____________________________________________" + "\ r \ n"); W.Write ("TOTAL" + total + "\ r \ n" + "\ r \ n"); W.Write ("-This is your official receipt" - "+" \ r \ n "); W.Write (" Thank you for buying! "); W.Close ();} Process. Start (" Notepad.  

Try changing

  path path = Application:  path path = application. (Path) =  StartupPath + "\\ receipt.txt";  

and

  Process.Start ("notepad.exe", Path).  

to
  Process.Start ("notepad.exe", "\" "+ path +" \ "");  

Changing this has helped some people in some cases

Due to spaces in folder names, it may help to provide quotes when there is a problem


No comments:

Post a Comment