Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Make MDI Child form Centre
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00388770
Message ID:
00390087
Vues:
10
I can think of one situation where you may use the form's name rather than declaring it as a variable: In a multi-thread app where you want all threads to access properties/methods on a common form. If each thread accesses the form using the form's name they will get the same instance of the form.

But as Vin said you are almost always better off instantiating your form to a variable. You have much better control over the scope of the form and avoid conficts with other modules calling the same form.

In short:
Form1.Show 'always calls the same instance of the form

Dim frm As New Form1 'creates a new private instance of Form1 every time
frm.Show ' you call a sub with this code in it.



>It is solved, because I have Set fMDIForm = New frmMDIMain, therefore the
>MDI form name should be fMDIForm instead of frmMDIMain.
>
>I learned the method of assigning a form into another name, like the above
>example. What are the advantages of doing in this way, rather then calling
>the form directly? As I learned this method from other people's applications.
George
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform