Notepad Coding
Notepad Coding
Notepad Coding
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace NotepadApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
if(sfd.FileName != "")
{
System.IO.FileStream fs = (System.IO.FileStream) sfd.OpenFile();
byte[] filetext = Encoding.ASCII.GetBytes(TextArea.Text);
fs.Write(filetext,0,filetext.Length);
fs.Close();
}
if (ofd.FileName != "")
{
String[] fileLines = System.IO.File.ReadAllLines(ofd.FileName);
TextArea.Text = "";
}
}
}
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
if (cutText.Length > 0)
{
TextArea.Text = TextArea.Text.Insert(TextArea.SelectionStart,
cutText);
}
else
{
TextArea.Text = TextArea.Text.Insert(TextArea.SelectionStart,
copyText);
}
}
}
}