Centering the Modal from in the application window

I am working on MDI application. In which I want to make use of modal froms in the place of messgae boxes as I shouldn't use message boxes in my application. Problem is I will be using dual monitor systems, When I call the form it is diplayed some where else when the application is on other screen. how can I make the form to be visible in the application window only, means in the centre of the child form which called it.
lesaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vmanoConnect With a Mentor Commented:
set this property called "StartUpPosition : 2- centerscreen"
(i am not sure which version of VB are you using, if you can't find it let me know)

vmano
0
 
shchukaCommented:
What version of VB are you using?  If it's version 5 or 6, you can use StartUpPosition property of the form.  Set it to 1 (CenterOwner), then display the form with

    frmModal.show vbModal, frmMdiChild.hwnd

If you're in VB version 3 or 4, you need to get the coordinates of the child window withing the mdi form, translate them into screen coordinates and then figure out the position for your modal form.

0
All Courses

From novice to tech pro — start learning today.