I have developed a student form asking student details such as name, address, class,
standard etc...
The details are saved to STUDENT table (SQL Database). There is a another form with datagridview control showing data of STUDENT table. The form2 can be shown on student form
by VIEW button on this form.

Problem : I want to select the data from datagridview on form2 and on click of OK button (form2), the detail should be displayed on student form for UPDATE and DELETE data.

I am using the following on btnok_click event of Form2 (the one having datagridview)

I have converted all private members to public.

frmStudent f1 = new frmStudent();

     f1.txtgrno.Text = dgvstudisplay.CurrentRow.Cells[0].Value.ToString();
     f1.txtlname.Text = dgvstudisplay.CurrentRow.Cells[1].Value.ToString();
     f1.txtfname.Text = dgvstudisplay.CurrentRow.Cells[2].Value.ToString();
     f1.txtfathername.Text = dgvstudisplay.CurrentRow.Cells[4].Value.ToString();
     f1.txtmothername.Text = dgvstudisplay.CurrentRow.Cells[5].Value.ToString();
     f1.combochildno.SelectedValue = dgvstudisplay.CurrentRow.Cells[6].Value.ToString();

Question :

according to me your logic will use to much resources of your computer becouse you assing each text box from from another form the best idea is only pickup primary key suppose studId from grideview and pass that value on onother form
pick up that value from that form and pass into query and fetch data will good for you and you application try it and if suitable please dont forgate to mark as solved