Hey just suggesting(as RyanDev said, use a reference),
1.put a constructor in Form2 to accept a object of Form1(declare another Form1 object as public in class level, and assign passed object to that inside the constructor),
2.when you create Form2, use that constructor and pass along Form2 object(ie: "this"),
and open Form2 as a dialog.
3.And, in the CellDoubleClick event, use public Form2 object to access it's contents(set the required cell value in FOrm1).
and you are done.
*I suggest not to declare a new object of Form1 in the CellDoubleClick event, because it creates a new instance, not the one you had.
public Purchase purchase = new Purchase();
public ViewStock(Purchase pp)
{
InitializeComponent();
xConnection = new SqlConnection("Data Source =.; DataBase=AccDB; UID=sa; Password=123;");
purchase = pp;
}
private void xDT_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex.Equals(0)) { ViewStock vs = new ViewStock(this); vs.ShowDialog(); }
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
this.Dispose();
}