In my application, I have an number of forms that pop up (modally) on top of the main form when certain buttons are clicked.
This works fine when my application is running on Monitor 1 as I preset the location of the form. However, if the user moves the main form to Monitor 2 and clicks these buttons, all of the popup forms still show on Monitor 1.
I found this code to push a form onto a second Monitor:
Form2.Location=Screen.AllScreens(UBound(Screen.AllScreens)).Bounds.Location + New Point(100,100)
Form2.Show()
However, is there a way I can detect what Monitor my Main Form is located on, and then push any requested forms onto that same monitor?
I also work with 3 Monitors, so I need all my forms to show on the same monitor as the Main app.
Thanks
With this way you would have to have a reference to the other forms, or use the OpenForms
property on the Application
namespace and iterate them.
Private Sub form_Move(sender As Object, e As EventArgs) Handles Me.Move
frm2.Location = New Point(Me.Location.X + 200, Me.Location.Y + 200)
' move others
End Sub