|I have a situation in which i have to pass reference to a form at run time. The two conditions which must be followed the project are :-
1. The calling (parent) form will be dynamic and the called (child) form will be a static one.
2. The called form may return a value to the calling form.
I have studied about and also explored abt in on net but the response i m getting abt it is that, i cannot refer to parent form's properties/methods/variables from child form untill i have a reference to it and i cannt get reference of it (parent form) since its referenced on run time therefore i dont know what will be the parent form and its variables.
Sample code : -
Instance of Child form created and showed.
frmList list = new frmList();
list.frmFromName = this;
Passing a value via the child form instance to parent form....
public Form frmFromName=new Form();
frmFromName.nMasterId = Convert.ToInt32(dataGridView1.Rows[nRowIndex].Cells.Value);