示例#1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có thật sự muốn xoá nhân viên này", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Lnhanvien nv = new Lnhanvien();
         nv.set_manhanvien(txtmanv.Text);
         if (nv.xoabo() == true)
         {
             MessageBox.Show("Bạn đã xoá bỏ thành công");
             listView1.Items[i].Remove();
             DataRow dr = ds.Tables[0].Rows.Find(txtmanv.Text);
             ds.Tables[0].Rows.Remove(dr);
             for (int j = i; j < ds.Tables[0].Rows.Count - 1; j++)
             {
                 s[j] = s[j + 1];
             }
             if (i > 0)
             {
                 i = i - 1;
             }
             load_textbox(i);
         }
         else
         {
             MessageBox.Show("Quá trình xoá bỏ gặp thất bại bạn hãy kiểm tra lại");
         }
     }
 }