コード例 #1
0
        // При клике на "Правка" -> "Изменить" открывается форма для изменения
        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
0
        // При 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();
                }
            }
        }