private void button2_Click(object sender, EventArgs e) { if (!(checkedListBox1.CheckedItems.Count == 0)) { Form30 f = new Form30(); this.Hide(); f.ShowDialog(); Close(); } else { MessageBox.Show("Надо ответить на вопрос", "Заголовок", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button3_Click(object sender, EventArgs e) { int index, n; string Personal_ID; string Surname, Posada_ID, NomerTelefony, KilkistPolotiv, Vik; string SqlText = "DELETE FROM [Personal] WHERE [Personal].Personal_ID = "; // перевірка, чи є взагалі записи в таблиці Source n = dataGridView1.Rows.Count; if (n == 1) { return; } Form30 f = new Form30(); index = dataGridView1.CurrentRow.Index; Personal_ID = Convert.ToString(dataGridView1[0, index].Value); // сформувати SQL-команду SqlText = SqlText + Personal_ID; // заповнити інформаційну довідку у вікні Form5 Personal_ID = Convert.ToString(dataGridView1[1, index].Value); Surname = Convert.ToString(dataGridView1[2, index].Value); Posada_ID = Convert.ToString(dataGridView1[2, index].Value); NomerTelefony = Convert.ToString(dataGridView1[2, index].Value); KilkistPolotiv = Convert.ToString(dataGridView1[2, index].Value); Vik = Convert.ToString(dataGridView1[2, index].Value); f.label2.Text = Personal_ID + " - " + Personal_ID + " - " + Surname + " - " + Posada_ID + "-" + NomerTelefony + "-" + KilkistPolotiv + "-" + Vik; if (f.ShowDialog() == DialogResult.OK) // вивести форму { // виконати SQL-команду MyExecuteNonQuery(SqlText); // відобразити таблицю Source Personal(); } }