Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            MemberForm memberForm = new MemberForm("member", true);

            memberForm.FormClosed += MemberForm_FormClosed;
            memberForm.Show();
        }
Beispiel #2
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     dataGridView1.Rows[e.RowIndex].Selected = true;
     // check edit, delete
     if (string.Equals(dataGridView1.Columns[e.ColumnIndex].Name, "checkEdit"))
     {
         string     memberNo   = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
         MemberForm memberForm = new MemberForm(memberNo, false);
         memberForm.FormClosed += MemberForm_FormClosed;
         memberForm.Show();
     }
     else if (string.Equals(dataGridView1.Columns[e.ColumnIndex].Name, "checkDelete"))
     {
         string idMember = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
         // show message
         dataProvider.ADD_UPDATE_DELETE("DELETE FROM member WHERE member_no = @para1", new object[] { idMember });
         MessageBox.Show("Delete successful!!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         loadData();
     }
     else
     {
         DataGridViewRow dr = dataGridView1.Rows[e.RowIndex];
         tbFirstName.DataBindings.Clear();
         tbLastName.DataBindings.Clear();
         tbFirstName.DataBindings.Add("Text", dataGridView1.DataSource, "firstname");
         tbLastName.DataBindings.Add("Text", dataGridView1.DataSource, "lastname");
     }
 }