Simple Notepad in C# WindowsForm

Опубликовано: 06 Июнь 2026
на канале: Code Seekers
157
10

functions used
Open ---Code
using (OpenFileDialog ofd=new OpenFileDialog(){Filter="Text document|*.txt",ValidateNames=true,Multiselect=false})
{
if(ofd.ShowDialog()==DialogResult.OK)
{
using(StreamReader sr=new StreamReader(ofd.FileName))
{
path = ofd.FileName;
Task(string)text = sr.ReadToEndAsync();
//string word is in andgle brackets instead of round brackets
textBox1.Text = text.Result;
}
}
}

Save---Code:

string name = saveFileDialog1.FileName;
File.WriteAllText(name, textBox1.Text);



Exit--Code:

Application.Exit();


Font--Code:

DialogResult result = fontDialog1.ShowDialog();
if (result == DialogResult.OK)
{
Font font = fontDialog1.Font;

this.textBox1.Font = font;
}

undo --Code:

if (textBox1.CanUndo)
{
textBox1.Undo();
}


redo

if (textBox1.CanRedo)
{
textBox1.Redo();
}

copy--Code:

textBox1.Copy();

paste--Code:

textBox1.Paste();

cut --Code:

textBox1.Cut();

all these operations are included...

Tools used:
Menustrip, richtextbox,Savedialogbox,fontdialogbox,opendialogbox etc

Facebook Page:
https://web.facebook.com/C0deSeekeRs/...

Email :
[email protected]

YouTube:
   / codeseekers  

Website:
https://programcodescpp.wixsite.com/p...