private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int i = this.dataGridView1.CurrentRow.Index; string str = dataGridView1.Rows[i].Cells[0].Value.ToString(); OpenDB(); SqlCommand comd2 = new SqlCommand("exec insertId '" + str + "'", sqlConn); comd2.ExecuteNonQuery(); CloseDB(); change mychange = new change(); //mychange.Owner = this; this.Hide(); mychange.ShowDialog(); //Application.ExitThread(); }