// редактирование private void toolStripButton2_Click(object sender, EventArgs e) { int index = dataGridView1.SelectedCells[0].RowIndex; int certificateType = 0; if (radioButton6.Checked) { certificateType = 1; } AddSertificat form = new AddSertificat(admin, certificateType, true, dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), dataGridView1.SelectedRows[0].Cells[1].Value.ToString(), dataGridView1.SelectedRows[0].Cells[2].Value.ToString(), dataGridView1.SelectedRows[0].Cells[3].Value.ToString()); form.Owner = this; if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { admin.ShowCertificateType(dataGridView1, radioButton6.Checked ? "1" : "0"); if (dataGridView1.Rows.Count > 0) { toolStripButton2.Enabled = toolStripButton3.Enabled = true; if (dataGridView1.Rows.Count > index) { dataGridView1.Rows[index].Selected = true; } } else { toolStripButton2.Enabled = toolStripButton3.Enabled = false; } } form.Dispose(); }
private void toolStripButton1_Click(object sender, EventArgs e) { int certificateType = 1; if (radioButton6.Checked) { certificateType = 1; } AddSertificat form = new AddSertificat(admin, certificateType); form.Owner = this; form.ShowDialog(); admin.ShowCertificateType(dataGridView1, radioButton6.Checked ? "1" : "0"); toolStripButton2.Enabled = toolStripButton3.Enabled = dataGridView1.Rows.Count > 0; form.Dispose(); }