My question is this:
I have a main form, and then another sub form. The sub form has checkboxes which, when closed, the values must be read by the main form.
Would it better to just set the sub form as invisble, hence using more memory and read the values directly
or
create global variables that store the data, and whenever the sub form is loaded, the variables load the data into the controls and whenever the sub form is unloaded the variables are updated.
The second option of the 2 obviously requires more code, but would it be more efficient than keeping the form loaded but invisible? The sub form is just a small form that will be opened rarely but values must be read from it from the main.
Thanks for your time.
Last edited by karter69; Dec 8th, 2002 at 07:19 AM.
It is better practice not to use global variables. You can add custom properties to your sub form and set them depending on the values of your checkboxes. You can then unload the sub form and the custom properties will still be available. They stay available until to set the sub form = Nothing.
I think their may be some misunderstanding on what im asking...
I have attached a project which should help.
If i just close the sub form, which has the text box, it's value (checked or not) is lost.
If i set it to invisible = False, the value is not lost because it has not been unloaded.
My question is whether it is better to unload the sub form, and store the values in variables or just set it to invisible = False.
The sub form will not be used often... by setting it to invisible = False instead of Unloading it, will it consume a substancial amount of more memory?