-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
50 lines (44 loc) · 1.34 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.IO;
using System.Windows.Forms;
namespace notepad
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dr = saveFileDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
StreamWriter Write = new StreamWriter(saveFileDialog1.FileName);
Write.Close();
Write.Write(saveFileDialog1.FileName);
file = saveFileDialog1.FileName;
}
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
richTextBox1.Clear();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private string file = "";
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dr = openFileDialog1.ShowDialog();
openFileDialog1.Filter = "";
if (dr == DialogResult.OK)
{
StreamReader read = new StreamReader(openFileDialog1.FileName);
read.Close();
file = openFileDialog1 .FileName;
}
}
}
}