Answers for "open text file in notepad c#"

0

open text file in notepad c#

private void button1_Click(object sender, EventArgs e)
	{
		string filename = "license.txt";
		if (!System.IO.File.Exists(filename))
			System.IO.File.WriteAllText(filename, Properties.Resources.License);
		// let windows decide which program it will use to open the file ...
		// whatever registered application for .txt extension is on the user system
		System.Diagnostics.Process.Start(filename);

		// or explicitely open file in notepad
		//System.Diagnostics.Process.Start("notepad.exe", filename);
	}
Posted by: Guest on October-16-2021

Browse Popular Code Answers by Language