// При клике на "Правка" -> "Изменить" открывается форма для изменения private void EditToolStripMenuItem_Click(object sender, EventArgs e) { Posts_employeesFormEdit formEdit = new Posts_employeesFormEdit(); Values.PostsEmployeesId = Convert.ToInt32(dataGridViewPostsEmployees.CurrentRow.Cells[0].Value); Values.PostsEmployeesEmployees = Convert.ToString(dataGridViewPostsEmployees.CurrentRow.Cells[1].Value); Values.PostsEmployeesPost = Convert.ToString(dataGridViewPostsEmployees.CurrentRow.Cells[2].Value); formEdit.ShowDialog(); SelectDatePostsEmployees(); }
// При 2-ом клике на ячейку можно провести редактирование private void dataGridViewPostsEmployees_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (Values.AuthRole_user != 2) { if (e.RowIndex != -1) { DataGridViewRow view = dataGridViewPostsEmployees.Rows[e.RowIndex]; Values.PostsEmployeesId = Convert.ToInt32(view.Cells[0].Value); Values.PostsEmployeesEmployees = view.Cells[1].Value.ToString(); Values.PostsEmployeesPost = view.Cells[2].Value.ToString(); Posts_employeesFormEdit formEdit = new Posts_employeesFormEdit(); formEdit.ShowDialog(); SelectDatePostsEmployees(); } } }