private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { Form2 form2 = new Form2(cnn, this); int row = dataGridView1.CurrentCell.RowIndex; if (dataGridView1.Rows[row].Cells[0].Value != null) { form2.getdata(row, dataGridView1.Rows[row].Cells[0].Value.ToString(), dataGridView1.Rows[row].Cells[1].Value.ToString(), dataGridView1.Rows[row].Cells[2].Value.ToString(), dataGridView1.Rows[row].Cells[3].Value.ToString()); form2.Show(); } }