Icon
How do I use Icon
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: frmCapNhat.cs
Copy
238 private void button2_Click(object sender, EventArgs e)
239 {
240 if (richTextBox1.Text == "")
241 {
242 MessageBox.Show("Vui lòng chọn câu hỏi", "Thông báo");
243 }
244 else
245 {
246 string sCauHoi = richTextBox1.Text;
247 if (MessageBox.Show("Bạn có muốn xóa câu hỏi" + " " + sCauHoi, "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
248 {
249 string sMaCH = textBox5.Text;
250 sqlcmd = new SqlCommand("delete cauhoi where mach='" + sMaCH + "'", sqlcon);
251 sqlcmd.ExecuteNonQuery();
252 sqlcmd = new SqlCommand("delete dapan where mach='" + sMaCH + "'", sqlcon);
253 sqlcmd.ExecuteNonQuery();
254 LoadDataToListView();
255 }
256 Bandau();
257 }
258 }
File name: frmDienTenTS.cs
Copy
30 private void btbatdauthi_Click(object sender, EventArgs e)
31 {
32 try
33 {
34 if (tbten.Text == "" || tbmathisinh.Text == "")
35 {
36 MessageBox.Show("Bạn phải điền đầy đủ thông tin");
37 }
38 else
39 {
40 string TenThSinh = tbten.Text;
41 string MaThiSinh = tbmathisinh.Text;
42 string strSQL = "insert THISINHTHI values('" + MaThiSinh + "','" + TenThSinh + "')";
43 SqlCommand ObjCmd = new SqlCommand(strSQL, ObjCon);
44 ObjCmd.ExecuteNonQuery();
45 if (MessageBox.Show("Bạn có chắc chắn thi không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
46 {
47
48 string dienten = this.tbten.Text;//chuyen thong tin sang form thithat
49 string dienma = this.tbmathisinh.Text;
50 frmThiThat thithat = new frmThiThat(dienten, dienma);
51 thithat.ShowDialog();
52 this.Close();
53
54
55 }
56
57 }
58 }
59 catch
60 {
61 MessageBox.Show("Mã thí sinh trùng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
62 }
63
64 }
File name: frmLogin.cs
Copy
27 private void btThoat_Click(object sender, EventArgs e)
28 {
29 if (MessageBox.Show("Bạn có muốn thoát hay không ", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.OK)
30 {
31 this.Close();
32 }
33 }
File name: frmLuaChon.cs
Copy
29 private void btThoat_Click(object sender, EventArgs e)
30 {
31 if (MessageBox.Show("Bạn có muốn thoát hay không","Thông Báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning) == DialogResult.OK)
32 {
33 this.Close();
34 }
35 }
File name: frmMain.cs
Copy
41 private void button1_Click(object sender, EventArgs e)
42 {
43 if (MessageBox.Show("Bạn có chắc chắn muốn thoát ?","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
44
45 {
46 Application.Exit();
47
48 }
49 }
File name: frmMain.cs
Copy
51 private void thoátToolStripMenuItem1_Click(object sender, EventArgs e)
52 {
53 if (MessageBox.Show("Bạn có chắc chắn muốn thoát ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
54 {
55 Application.Exit();
56
57 }
58 }
File name: frmMain.cs
Copy
113 private void thoátToolStripMenuItem2_Click_1(object sender, EventArgs e)
114 {
115 if (MessageBox.Show("Bạn có chắc chắn muốn thoát ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
116 {
117 Application.Exit();
118
119 }
120 }
File name: frmThi.cs
Copy
197 private void btNext_Click(object sender, EventArgs e)
198 {
199 test();
200 getdapan();
201 iRows += sodonghienlen;
202 getData(iRows);
203 if (i < 1)
204 return;
205 else
206 {
207 //strsoluongcauhoi1 = frmluachon.strsoluongcauhoi;
208 i++;
209 if (int.Parse(strsoluongcauhoi1)< i)
210 {
211 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
212 if (MessageBox.Show("Bạn đã làm xong","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning)== DialogResult.OK)
213 {
214
215 }
216 }
217 else
218 {
219 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
220 }
221 }
222 j = j + 1;
223 }
File name: frmThiThat.cs
Copy
261 private void btketthuc_Click(object sender, EventArgs e)
262 {
263 if (MessageBox.Show("Bạn có chắc chắn kết thúc không ?" , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
264 {
265 this.Hide();
266 try
267 {
268 timer1.Stop();
269 btketthuc.Enabled = false;
270
271 GhiLaiDapAnTS();
272 SoCauDung = 0;
273 for (int i = 0; i < SoCauHoi; i++)
274 {
275 if (BangDeThi.Rows[i][6].ToString().ToUpper() == BangDeThi.Rows[i][7].ToString().ToUpper())
276 SoCauDung++;
277
278 }
279
280 diem = SoCauDung * 2;
281 MessageBox.Show("Đúng " + SoCauDung.ToString() + " câu " + " Bạn được " + diem.ToString() + " điểm ");
282 this.Close();
283 string ten = lbhoten.Text;
284 string mats = lbmathisinh.Text;
285 string diem1 = diem.ToString();
286 string socaudung = SoCauDung.ToString();
287 frmKetQua ketqua = new frmKetQua(ten,mats,diem1,socaudung);
288 ketqua.ShowDialog();
289 //them form ket qua tai day
290
291 }
292 catch (Exception ex)
293 { MessageBox.Show(ex.Message); }
294 }
295 else
296 { return; }
297 }
File name: Lichsuthi.cs
Copy
55 private void timkiemtheongay()
56 {
57 if (tbngaythang.Text == "")
58 {
59 rdb1.Checked = false;
60 MessageBox.Show("Bạn điền ngày tháng năm vao trước, theo dạng tháng / ngày / năm", "Có lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
61 tbngaythang.Enabled = true;
62 }
63 else
64 {
65
66 Sngay = tbngaythang.Text;
67 try
68 {
69
70
71 sqlcmd = new SqlCommand("select thisinhthi.mats,HOTEN,NGAYTHI,SOCAUDUNG,SOCAUSAI,DIEM FROM THISINHTHI,KETQUA WHERE THISINHTHI.MATS=KETQUA.MATS and ngaythi='" + Sngay + "'", sqlcon);
72 SqlDataReader sqlreader = sqlcmd.ExecuteReader();
73 listView1.Items.Clear();
74 while (sqlreader.Read())
75 {
76 ListViewItem lvitem = new ListViewItem();
77 lvitem.Text = sqlreader["MATS"].ToString();
78 lvitem.SubItems.Add(sqlreader["HOTEN"].ToString().Trim());
79 lvitem.SubItems.Add(sqlreader["NGAYTHI"].ToString().Trim());
80 lvitem.SubItems.Add(sqlreader["SOCAUDUNG"].ToString().Trim());
81 lvitem.SubItems.Add(sqlreader["SOCAUSAI"].ToString().Trim());
82 lvitem.SubItems.Add(sqlreader["DIEM"].ToString().Trim());
83 listView1.Items.Add(lvitem);
84 }
85 sqlreader.Close();
86
87 }
88 catch
89 {
90 MessageBox.Show("Không có ai thi ngày này '" + Sngay + "'");
91 tbngaythang.Text = "";
92
93
94 }
95 }
96 }
Download file with original file name:Icon
Icon 250 lượt xem
Gõ tìm kiếm nhanh...