Link to home
Start Free TrialLog in
Avatar of rocky050371
rocky050371

asked on

Form Level Scope

When declaring / launching a new form a menu item, should the variable be set to module level rather than procedure, what is the best practice.

        _form = New ListForm()
         _form.Show()

or dim frm as form = new ListForm

   

Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

if you do not need the reference to your _form from elsewhere then in the procedure, declare it local to the procedure
It might be useful to declare it at the form/class level if you want to keep an easy reference so you can allow only one instance of the form to be opened at any one time.

*They are others ways of doing this as well.

ASKER CERTIFIED SOLUTION
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial