private void button1_Click(object sender, EventArgs e) { InsertForm insert = new InsertForm(); insert.ShowDialog(); LoadTable(); }
private void button2_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { InsertForm update = new InsertForm(); update.textBox1.ReadOnly = true; update.button2.Enabled = false; update.button1.Text = "Update"; update.textBox1.Text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); update.textBox2.Text = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); update.textBox3.Text = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); update.ShowDialog(); LoadTable(); } else { MessageBox.Show("Please Select the entire Row "); } }