private void _dgv2_MouseDoubleClick(object sender, MouseEventArgs e) { try { if (_dgv2.Rows[_dgv2.SelectedCells[0].RowIndex].Cells["ulpu_id"].Value.ToString() == "0") { MessageBox.Show("Для редактирования выделите ЛПУ.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } EditUserLPU eULPU = new EditUserLPU(_dgv2.Rows[_dgv2.SelectedCells[0].RowIndex].Cells["ulpu_id"].Value.ToString(), cbSDiv.SelectedItem.ToString(), cbRegions.SelectedValue.ToString(), cbUsers.SelectedValue.ToString()); eULPU.ShowDialog(); } catch { MessageBox.Show("Не удалось войти в режим редактирования.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void _dgv2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if ((e.ColumnIndex < 0) || (e.RowIndex < 0)) return; UserLpuRR userLpu = GetUserLpuRR(); EditUserLPU editUserLPU = new EditUserLPU(userLpu); if (editUserLPU.ShowDialog() == System.Windows.Forms.DialogResult.OK) loadData2(); }