private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { string id = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); if (e.ColumnIndex == 5) { DialogResult dr = MessageBox.Show("คุณต้องการลบข้อมูลนี้หรือไม่ ?", "ลบข้อมุล", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { this.deleteData(id); } } if (e.ColumnIndex == 4) { CustomerAdd da = new CustomerAdd(this); da.ID = id; da.Show(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void button2_Click_1(object sender, EventArgs e) { CustomerAdd acf = new CustomerAdd(this); acf.Show(); }