Question MDI Forms and passing Information

MGrove

New member
Joined
Dec 17, 2010
Messages
2
Programming Experience
5-10
I need a best practice answer:
Example Form1 with data bound controls and a Public Variable Form1Var
Form2 with data bound controls and a Public Variable Form2Var
DataTables are related Form2 Data is related to Form1 Data in a one-to-many
What I am trying to accomplish.
When editing Form1 data there is a button to open Form2 if new data needs to be added. on closing Form2 I would like Form1 to remain at the state it was in before opening Form2. If I Change Visibility of Form1 when Form2 is opened upon Retun to Form1 Data is reloaded, if I minimise Form1 when Form2 is opened upon return to Form1 Public variables are reset to defaults. Any Help would be appreciated.
I have many Forms with many controls and buttons to do Lookups or additional add to related tables.
Thanks
 
My first comment with regards to best practice is to get rid of the public variables. Best practice dictates that all variables be private and any data that needs to be exposed publicly is done via properties.

It sounds to me like your design needs some work. Are you saying that those forms are both MDI children? It certainly doesn't sound like they should be. Also, the data on the first form won't reload itself. If data is being reloaded it's because your code is reloading it. Without significantly more detail, we can't really tell where the "issue" might be.
 
jmcilhinney, Thanks for the response, I'll do some recoding of the variables to properties and then see how the Forms respond.
 
Back
Top