
Lập trình C# - Code đăng nhập
lượt xem 166
download

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO;
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Lập trình C# - Code đăng nhập
- using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace BAIBACCAO { public partial class notepad : Form { public notepad() { InitializeComponent(); } String filename = ""; private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.Clear(); } private void newToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.Text = ""; this.Text = "Untitled"; filename = ""; } private void openToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.Filter = "Text Files (*.txt)|*.txt|Word Documents" + "(*.doc)|*.doc|All Files (*.*)| *.*"; try { if (openFileDialog1.ShowDialog() == DialogResult.OK) { filename = openFileDialog1.FileName; this.Text = filename; StreamReader strReader;// bien dung de doc du lieu ra strReader = File.OpenText(filename); txtnoidung.Text = strReader.ReadToEnd(); strReader.Close(); } } catch { MessageBox.Show("Lỗi chương trình ?");
- } } private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (filename == "") { saveFileDialog1.Filter = "Text Files (*.txt)|*.txt|Word Documents" + "(*.doc)|*.doc|All Files (*.*)| *.*"; saveFileDialog1.FileName = "Untitled"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { //'Luu noi dung filename = saveFileDialog1.FileName; FileStream fStream;//chua ten moi StreamWriter strWriter;//dung doc fStream = File.Create(filename); fStream.Close(); strWriter = File.AppendText(filename); strWriter.Write(txtnoidung.Text); strWriter.Close(); this.Text = filename; } } else { //'Luu noi dung FileStream fStream; StreamWriter strWriter; fStream = File.Create(filename); fStream.Close(); strWriter = File.AppendText(filename); strWriter.Write(txtnoidung.Text); strWriter.Close(); this.Text = filename; } } private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { saveFileDialog1.Filter = "Text Files (*.txt)|*.txt|Word Documents" + "(*.doc)|*.doc|All Files (*.*)| *.*"; saveFileDialog1.FileName = "Untitled"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { filename = saveFileDialog1.FileName;
- FileStream fStream; //bien chua ten file can tao de luu StreamWriter strWriter; //bien dung de ghi du lieu vao fStream = File.Create(filename); fStream.Close(); //tao song roi dong lai strWriter = File.AppendText(filename); //gan noi dung vao cho bien strWriter.Write(txtnoidung.Text); //thuc hien ghi strWriter.Close(); } } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Close(); } private void notepad_Load(object sender, EventArgs e) { txtnoidung.Size = new Size(this.ClientRectangle.Width - 4, this.ClientRectangle.Height - 28); txtnoidung.Location = new Point(2, 26); } private void notepad_Resize(object sender, EventArgs e) { txtnoidung.Size = new Size(this.ClientRectangle.Width - 4, this.ClientRectangle.Height - 28); txtnoidung.Location = new Point(2, 26); } private void unduToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.Undo(); } private void cutToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.Cut(); } private void pastToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.Paste(); } private void copyToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.Copy();
- } private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { txtnoidung.SelectAll(); } private void dataTimeToolStripMenuItem_Click(object sender, EventArgs e) { System.DateTime currentTime = System.DateTime.Now; txtnoidung.Text = txtnoidung.Text + " " + DateTime.Now; } private void fontToolStripMenuItem_Click(object sender, EventArgs e) { if (fontDialog1.ShowDialog() == DialogResult.OK) { txtnoidung.Font = fontDialog1.Font; } } private void fontcolorToolStripMenuItem_Click(object sender, EventArgs e) { if (colorDialog1.ShowDialog() == DialogResult.OK) { txtnoidung.ForeColor = colorDialog1.Color; } } private void backGoundToolStripMenuItem_Click(object sender, EventArgs e) { if (colorDialog1.ShowDialog() == DialogResult.OK) { txtnoidung.BackColor = colorDialog1.Color; } } private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e) { if (wordWrapToolStripMenuItem.Checked) { txtnoidung.WordWrap = true; txtnoidung.ScrollBars = ScrollBars.Vertical; } else { txtnoidung.WordWrap = false; txtnoidung.ScrollBars = ScrollBars.Both; }
- } private void saveWithKeyToolStripMenuItem_Click(object sender, EventArgs e) { //MessageBox.Show("Nhóm em chưa làm được ?"); } private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { } } }

CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bài tập lập trình Windows dùng C# - Bài số 7
18 p |
389 |
99
-
Nhập môn lập trình (Đặng Bình Phương) - Giới thiệu môn học
8 p |
590 |
90
-
ĐỀ CƯƠNG THỰC HÀNH HỌC PHẦN: NGÔN NGỮ LẬP TRÌNH BẬC CAO
11 p |
362 |
80
-
Kế hoạch giảng dạy môn Lập trình C
5 p |
263 |
56
-
NHẬP MÔN LẬP TRÌNH-CÁC KHÁI NIỆM CƠ BẢN VỀ HỆ ĐIỀU HÀNH
17 p |
155 |
32
-
Bài giảng Ngôn ngữ lập trình C++ - Chương 7: Ra vào dữ liệu
93 p |
163 |
28
-
Bài giảng Lập trình hướng đối tượng - Chương 2: Đối tượng và lớp
21 p |
178 |
15
-
Bài giảng Ngôn ngữ lập trình C - Chương 13: Toán tử trên lớp
12 p |
92 |
12
-
Bài giảng Lập trình hướng đối tượng - Chương 3: Kế thừa
18 p |
148 |
10
-
Bài giảng lập trình c căn bản - Trường Apptech - Chương 4
27 p |
132 |
7
-
Bài giảng Ngôn ngữ lập trình C và C++ (Phần 2: Ngôn ngữ lập trình C++) - Chương 5: Các lớp nhập/xuất trong C++
19 p |
141 |
7
-
Bài giảng Ngôn ngữ lập trình C: Các thành phần cơ bản - TS. Ngô Hữu Dũng
45 p |
73 |
7
-
Bài giảng Nhập môn lập trình: Giới thiệu ngôn ngữ lập trình C- ThS. Đặng Đình Phương
14 p |
91 |
5
-
Báo cáo bài tập lớp - Môn: Nhập môn về lập trình
11 p |
125 |
5
-
Bài giảng Nhập môn lập trình C - Chương 3: Hàm
35 p |
73 |
4
-
Bài giảng Lập trình cơ bản - Chương 4: Nhập và xuất trong C
29 p |
78 |
3
-
Bài giảng Nhập môn lập trình: Bài 2 - TS. Ngô Hữu Dũng
53 p |
79 |
3
-
Bài giảng Nhập môn về lập trình - Chương 6: Hàm (Function)
19 p |
37 |
3


Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn
