private void dgv_zone_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; if (index != -1) { DataGridViewRow selectedRow = dgv_zone.Rows[index]; string tableZoneId = selectedRow.Cells["tablezone_id"].Value.ToString(); using (ZoneED zoneED = new ZoneED(tableZoneId)) { if (zoneED.ShowDialog() != DialogResult.Cancel) { btn_clear.Hide(); txtz_search.Clear(); txtz_search.Focus(); refreshZone(tableZone.getTableZone()); } } } }
private void btn_addZone_Click(object sender, EventArgs e) { try { using (ZoneED zoneED = new ZoneED()) { if (zoneED.ShowDialog() != DialogResult.Cancel) { btn_clear.Hide(); txtz_search.Clear(); txtz_search.Focus(); refreshZone(tableZone.getTableZone()); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }