RESULT_OK









How do I use R E S U L T_ O K
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


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: frmLogin.cs Copy
66         private void btLog_Click(object sender, EventArgs e)
67         {
68             try
69             {
70                 if (txtdangnhap.Text == "" || txtmatkhau.Text == "")
71                 {
72                     MessageBox.Show("Bạn chưa điền đầy đủ thông tin", "Có lỗi xảy ra!");
73                     txtdangnhap.Focus();
74                     return;
75                 }
76                     if(txtdangnhap.Text=="admin" && txtmatkhau.Text=="admin")
77                     {
78                         if (MessageBox.Show("Chào mừng bạn đã đến với mục quản lý dành cho giáo viên", "Thông báo", MessageBoxButtons.OK) == DialogResult.OK)
79                         {
80                             this.Hide();
81                             frmQuanLy_Admin admin = new frmQuanLy_Admin();
82                             admin.ShowDialog();
83
84                         }
85
86                     }
87                 else
88                 {
89                     SqlConnection con = new SqlConnection("server=.\\SQLEXPRESS;database=QL_Thitracnghiem;integrated security=true");
90                     con.Open();
91                     SqlCommand cmd = new SqlCommand("Select MatKhau from THISINH where TenDangNhap ='" + txtdangnhap.Text + "'", con);
92                     SqlDataReader reader = cmd.ExecuteReader();
93                     reader.Read();
94                     if (txtmatkhau.Text == reader.GetValue(0).ToString())
95                     {
96                         MessageBox.Show("Bạn đã đăng nhập thành công!", "Thành công");
97                         reader.Close();
98                         con.Close();
99                         this.Close();
100                         frmLuaChon frmChon = new frmLuaChon();
101                         frmChon.ShowDialog();
102                         this.Hide();
103
104                     }
105                     else
106                     {
107                         MessageBox.Show("Sai Mật Khẩu");
108                         txtmatkhau.Focus();
109                     }
110                     reader.Close();
111                     con.Close();
112                 }
113
114             }
115
116             catch (Exception)
117             {
118
119                 MessageBox.Show("Tên đăng nhập và mật khẩu không hợp lệ","Có lỗi xảy ra");
120                 txtdangnhap.Focus();
121
122             }
123         }
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: frmColor.cs Copy
28   public ColorInput()
29   {
30    //
31    // Required for Windows Form Designer support
32    //
33    InitializeComponent();
34
35    OK.DialogResult = System.Windows.Forms.DialogResult.OK;
36    Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
37   }
File name: frmMainMenu.cs Copy
393         private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
394         {
395             try
396             {
397                 var _with1 = openFileDialog1;
398                 _with1.Filter = ("DB Backup File|*.bak;");
399                 _with1.FilterIndex = 4;
400                 //Clear the file name
401                 openFileDialog1.FileName = "";
402
403                 if (openFileDialog1.ShowDialog() == DialogResult.OK)
404                 {
405                     Cursor = Cursors.WaitCursor;
406                     timer2.Enabled = true;
407                     SqlConnection.ClearAllPools();
408                     con = new SqlConnection(cs.DBConn);
409                     con.Open();
410                     string cb = "USE Master ALTER DATABASE [" + System.Windows.Forms.Application.StartupPath + "\\pos_db.mdf] SET Single_User WITH Rollback Immediate Restore database [" + System.Windows.Forms.Application.StartupPath + "\\pos_db.mdf] FROM disk='" + openFileDialog1.FileName + "' WITH REPLACE ALTER DATABASE [" + System.Windows.Forms.Application.StartupPath + "\\pos_db.mdf] SET Multi_User ";
411                     cmd = new SqlCommand(cb);
412                     cmd.Connection = con;
413                     cmd.ExecuteReader();
414                     MessageBox.Show("Successfully performed", "Database Restore", MessageBoxButtons.OK, MessageBoxIcon.Information);
415                     GetData();
416                 }
417             }
418             catch (Exception ex)
419             {
420                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
421             }
422         }
File name: frmProduct.cs Copy
306         private void button1_Click(object sender, EventArgs e)
307         {
308               try
309             {
310                 var _with1 = openFileDialog1;
311
312                 _with1.Filter = ("Image Files |*.png; *.bmp; *.jpg;*.jpeg; *.gif;");
313                 _with1.FilterIndex = 4;
314                 //Reset the file name
315                 openFileDialog1.FileName = "";
316
317                 if (openFileDialog1.ShowDialog() == DialogResult.OK)
318                 {
319                     pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
320                 }
321
322             }
323             catch (Exception ex)
324             {
325                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
326             }
327         }

RESULT_OK 117 lượt xem

Gõ tìm kiếm nhanh...