Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make MDI Child form Centre
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00388770
Message ID:
00390096
Views:
8
So, am I right to say that it is generally a good practise to always
create a new private instance of a form rather then calling by its
original name?

>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform