Search This Blog

Thursday, July 9, 2009

Simple code to save a text file

SaveFileDialog sdlg = new SaveFileDialog();

sdlg.Title = "Select a file name to save";
sdlg.Filter = "Text File|*.txt|All File|*.*";
if (sdlg.ShowDialog() != DialogResult.Cancel)
{
Application.DoEvents();

System.IO.File.WriteAllText(sdlg.FileName, txt_TextContainer.Text);

}

No comments:

Post a Comment