I have 2 forms.
On form1 there is a textbox called textbox1 and a button [and many other textboxes as well]
On clicking the button , a new form , form2 opens
form 2 has a datagridview with 2 columns.
On clicking the datagridview cell [present in form2] Using :
private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
,
The contents of the first column of the selected row must go to the textbox1 in form1 , without refreshing or reopening form1 .
How do I do that without using the .show() method as it would refresh my form1 and as a result lose all the user-typed info in the other textboxes?
Note: retrieval from datagridview to string form is done by:
dataGridView.SelectedRows[0].Cells[1].Value.ToString()
myNewForm2.Form1Instance = this;(thisis Form1 if you open Form2 from there). -- My second suggestion was to create an event. An example of an event isButton1_Clickwhen you click a button calledButton1. You even have an event in your question:dataGridView_CellMouseClick. You can read about creating events on MSDN. - Visual Vincent