-
Hello All,
when I declare a dim on a form in the general area is it default private to the form public to all forms?
when I unload the form, will these dims disappear?
I'm wondering because I created some ADO.recordsets and when I close the form (click on the x)and reopen the form I get an error stating that the recordsets are still open.
I have since put statements to close the ado.recordsets in the form unload but what the hell? How can they be open if I close the form anyways? cause when I reopen the form it has to redeclare the variables doesn't it? or does form1.show only unhides it?
what there like no garbage collection?
Thanks !
Marci Sarwan ([email protected])
-
By default, declarations at a general level are Public. The objects you declare should be destroyed when the form is destroyed, however it depends what and when you are doing. You may not be destroying the form properly. It is always best to close the recordsets explicitly. Garbage collection in VB is not fool proof.
Code snippets might help.
Cheers,
Paul
-
Variables declared as Dim in the General Declarations are Public, by default, to any procedures in that form but are not public outside of that form. e.g. modules, class modules, etc.