private void grvStation_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { FrmDetailStation frm = new FrmDetailStation(sourceData[e.RowIndex], this); frm.Show(); } else if (e.ColumnIndex == 1) { if (MessageBox.Show("Delete record?", "Confirm", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { DeleteStationDevice(sourceData[e.RowIndex].StationID); DeleteStationChannelDevice(sourceData[e.RowIndex].StationID); DeleteStation(sourceData[e.RowIndex].StationID); MessageBox.Show("Record Deleted Successfully!"); } } }
private void btnAdd_Click(object sender, EventArgs e) { FrmDetailStation frm = new FrmDetailStation(new StationViewModel(), this); frm.Show(); }