First of all for passing value from one form to another we need to use Constructor,
here in your scenario you have 2 forms
1) having textbox and button.
2) having the datagridview.
now when you click the button from form1 ,form2 pop ups.now you want to select value from datagridview and display that value in text box of form1.
for achieving this you just need to do 2 things.
1) create a parameterised constructor in form1 which will ask a string paramter like that.
public Form1(string val)
TextBox1.Text = val;
2) on the form2 fire "datagrid_CellClick" event
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
Form1 ob = new Form1(val);
this event will return you row index which is clicked and column index you have selected.now you will get the value you have selected and pass that value to the constructor of form1 for displaying it.