Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make MDI Child form Centre
Message
From
08/07/2000 05:25:58
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00388770
Message ID:
00389804
Views:
10
>>>>How to make the display of a Child MDI form to always display
>>>>in the Centre of the screen everytime a .Show command is issued?
>>>
>>>In your child form, add this:
>>>
>>>Private Sub Form_Resize()
>>>    Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
>>>    Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
>>>End Sub
>>>
>>
>>I faced a run-time error as follows:
>>
>>Run-time error '426'
>>Only one MDI Form allowed.
>>
>>Private Sub Form_Resize()
>> Me.Left = (frmMDIMain.ScaleWidth - Me.Width) / 2
>> Me.Top = (frmMDIMain.ScaleHeight - Me.Height) / 2
>>End Sub
>>
>>I changed MDIForm1 to my MDI form named "frmMDIMain".
>
>Have you placed this code in your child form? Do you have more than 1 MDI form in your project?

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