How to open text in Notepad from .NET?

前端 未结 4 1928
太阳男子
太阳男子 2020-12-08 20:38

When I click a button on a Windows Forms form, I would like to open a Notepad window containing the text from a TextBox control on the form.

How can I do that?

4条回答
  •  感情败类
    2020-12-08 21:08

    Try this out:

    System.IO.File.WriteAllText(@"C:\test.txt", textBox.Text);
    System.Diagnostics.Process.Start(@"C:\test.txt");
    

提交回复
热议问题