Try this
Create a
TextBox
property in
Form2
as
public partial class Form2 :Form
{
public TextBox ParentFormTextBox { get; set; }
public Form2()
.
.
before showing the Form2, initialize the above property with the Current (Form1) Form's
TextBox
as
Form2 objForm2 = new Form2();
objForm2.ParentFormTextBox = this.textBox_Whatever;
objForm2.Show();
and assign the values of the datagridview cell to the Parent Form's
TextBox
using
CellClick
event as
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1 && e.ColumnIndex > -1)
{
string value = Convert.ToString( dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
ParentFormTextBox.Text = value;
}
}