private void gridComands_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= this.gridComands.Rows.Count || e.ColumnIndex < 0 || e.ColumnIndex >= this.gridComands.Columns.Count) return; DataGridViewLinkCell linkCell = this.gridComands.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewLinkCell; if (linkCell != null) { String regType = this.gridComands.Rows[e.RowIndex].Cells[2].Value.ToString(); String regName = this.gridComands.Rows[e.RowIndex].Cells[3].Value.ToString(); if (linkCell.Value.Equals("edit")) { FrmCommandRegister frmCmdReg = new FrmCommandRegister(); frmCmdReg.showData(regType, regName); DialogResult hasil = frmCmdReg.ShowDialog(this); if (hasil == DialogResult.OK) { showCommandRegister(true); } } else if (linkCell.Value.Equals("delete")) { if (MessageBox.Show("Are you sure?", "Delete Data", MessageBoxButtons.YesNo) == DialogResult.Yes) { FrmCommandRegister frmCmdReg = new FrmCommandRegister(); frmCmdReg.deleteData(regType, regName); showCommandRegister(true); } } //MessageBox.Show("ada : " + regType + "-" + regName); } }
private void Btn_Add_Cmd_Click(object sender, EventArgs e) { FrmCommandRegister frmCmdReg = new FrmCommandRegister(); DialogResult hasil = frmCmdReg.ShowDialog(this); if (hasil == DialogResult.OK) { showCommandRegister(true); } }