// При клике на "Правка" -> "Изменить" открывается форма для изменения private void EditToolStripMenuItem_Click(object sender, EventArgs e) { Values.ProjectsTaskId = Convert.ToInt32(dataGridViewProjects_task.CurrentRow.Cells[0].Value); Values.ProjectsTaskProject = Convert.ToString(dataGridViewProjects_task.CurrentRow.Cells[1].Value); Values.ProjectsTaskType_task = Convert.ToString(dataGridViewProjects_task.CurrentRow.Cells[2].Value); Values.ProjectsTaskEmployee = Convert.ToString(dataGridViewProjects_task.CurrentRow.Cells[3].Value); Values.ProjectsTaskProject_role = Convert.ToString(dataGridViewProjects_task.CurrentRow.Cells[4].Value); Projects_taskFormEdit formEdit = new Projects_taskFormEdit(); formEdit.ShowDialog(); SelectDateProject_task(); }
// При 2-ом клике на ячейку можно провести редактирование private void dataGridViewProjects_task_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (Values.AuthRole_user != 2) { if (e.RowIndex != -1) { DataGridViewRow view = dataGridViewProjects_task.Rows[e.RowIndex]; Values.ProjectsTaskId = Convert.ToInt32(view.Cells[0].Value); Values.ProjectsTaskProject = view.Cells[1].Value.ToString(); Values.ProjectsTaskType_task = view.Cells[2].Value.ToString(); Values.ProjectsTaskEmployee = view.Cells[3].Value.ToString(); Values.ProjectsTaskProject_role = view.Cells[4].Value.ToString(); Projects_taskFormEdit formEdit = new Projects_taskFormEdit(); formEdit.ShowDialog(); SelectDateProject_task(); } } }