hi guys. i m working with multiple forms in my c# program. assuming i have 2 forms, form 1 and form 2, i have learnt that in order to access form2's textboxes in form1 while returning from the ShowDialog method, the easiest way is to set all the textboxes in form2 modifier to public.
I am now having a problem. In form2, i wished to access the members in form1. How do i achieve so? I tried the below code but it fails:

While I m in form 2 ...
Code:
MainFrm mainFrm = (MainFrm) this.ParentForm;
MessageBox.Show(mainFrm.myConn.ConnectionString);
When I run, I get a System.NullReferenceException. There's nothing wrong with the connection string. I tried it in form 1 and it works. Thanks for any help.