using System;using System.Windows.Forms;using System.IO;namespace prash_textpad{ public partial class prash_textpad : Form { public prash_textpad() { InitializeComponent(); } private void open_btn_Click(object sender, EventArgs e) { openFileDialog1.Filter = "text|*.txt|documents|*.doc|AllFiles|*.*"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); string s, str = null; s = sr.ReadLine(); while (s != null) { str = str + s + Convert.ToChar(13) + Convert.ToChar(10); s = sr.ReadLine(); } textBox1.Text = str; sr.Close(); fs.Close(); } } private void save_btn_Click(object sender, EventArgs e) { saveFileDialog1.Filter = "text|*.txt|documents|*.doc|AllFiles|*.*"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(saveFileDialog1.FileName, FileMode.Create, FileAccess.ReadWrite); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(textBox1.Text); sw.Close(); fs.Close(); } } private void clear_btn_Click(object sender, EventArgs e) { textBox1.Clear(); } private void exit_btn_Click(object sender, EventArgs e) { this.Close(); } }}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: