Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- namespace TextEditor01
- {
- public partial class frmEditor : Form
- {
- public frmEditor()
- {
- InitializeComponent();
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- string sText = txtEditor.Text;
- string sFname = "";
- if(saveFileDialog1 .ShowDialog ()==DialogResult.OK)
- {
- sFname = saveFileDialog1.FileName;
- StreamWriter sw = new StreamWriter(sFname, true);
- sw.WriteLine(sText);
- sw.Close();
- MessageBox.Show("File is Saved!");
- }
- else
- {
- MessageBox.Show("File saving cancel!");
- }
- }
- private void btnClear_Click(object sender, EventArgs e)
- {
- txtEditor .Clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement