Question Need Help on start form on second screen

xHBx

New member
Joined
Feb 8, 2019
Messages
3
Programming Experience
Beginner
Hi All

I could like to request some help from you guy as I still can figure the way on start a form in second screen

I have 2 monitor in extended mode both with the resolution of 1024 * 768

First monitor on the left
Second Monitor on the right


i found the following code online but I can't get the location correctly
Dim SecondMonitor = Screen.AllScreens.FirstOrDefault(Function(x) Not x.Primary)
        If SecondMonitor IsNot Nothing Then
            Dim NewLocation = SecondMonitor.Bounds.Location
            NewLocation.Offset(100, 100)
            Me.Location = NewLocation
        End If


Is there a easy way to start a form on second screen IF Exist?


Hope to receive help from you guy. Thanks
 
Last edited by a moderator:
Hi All

I could like to request some help from you guy as I still can figure the way on start a form in second screen

I have 2 monitor in extended mode both with the resolution of 1024 * 768

First monitor on the left
Second Monitor on the right


i found the following code online but I can't get the location correctly
Dim SecondMonitor = Screen.AllScreens.FirstOrDefault(Function(x) Not x.Primary)
If SecondMonitor IsNot Nothing Then
    Dim NewLocation = SecondMonitor.Bounds.Location
    NewLocation.Offset(100, 100)
    Me.Location = NewLocation
End If


Is there a easy way to start a form on second screen IF Exist?


Hope to receive help from you guy. Thanks
As jmc has already stated you need to change the form's StartPosition to Manual before setting the location values, otherwise it's ignored:
Dim SecondMonitor = Screen.AllScreens.FirstOrDefault(Function(x) Not x.Primary)
If SecondMonitor IsNot Nothing Then
    Dim NewLocation = SecondMonitor.Bounds.Location
    NewLocation.Offset(100, 100)
    Me.StartPosition = FormStartPosition.Manual
    Me.Location = NewLocation
End If
 
Back
Top