I ran into this scenario recently, and try as I might I could not find a good code example that moved a form to a specific desktop screen. Perhaps it's because the solution is so simple when you look at it.
In my situation, I have an application that creates a form for each production monitor that is located throughout the plant. Each of these monitors connect directly to the main computer as an extended desktop. Each form is customized for the area in which the monitor is located.
Using something similar to the code below, you can specifically set which monitor your form will display on:
vb.net Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' THIS USES THE SCREEN CLASS TO GET THE COLLECTION OF SCREENS ON THE COMPUTER
For Each View As Screen In System.Windows.Forms.Screen.AllScreens()
' EACH SCREEN HAS A DEVICE NAME SIMILAR TO \\.\DISPLAY1
Dim str As String = View.DeviceName
' WE WANT TO GET THE NUMBER AT THE END OF THE DEVICENAME
' I ENTERED THE NUMBER 2 AS A STRING, BUT THIS COULD EASILY BE SET IN A CONFIG FILE OR DATABASE
If str.EndsWith("2") Then
' IN ORDER TO MOVE THE FORM'S LOCATION ON YOUR DESKTOP, CALL THE SETDESKTOPLOCATION METHOD
Me.SetDesktopLocation(View.WorkingArea.Left, View.WorkingArea.Top)
' IN MY CASE, I WANT THE FORM TO BE MAXIMIZED ON THE SCREEN
' YOU CAN EASILY CUSTOMIZE THE SIZE OF YOUR FORM BY USING THE PROPERTIES OF VIEW.WORKINGAREA
' ALTERNATELY, YOU CAN USE VIEW.BOUNDS
Me.WindowState = FormWindowState.Maximized
' NO NEED TO CYCLE THROUGH THE OTHER SCREENS IF WE FOUND THE RIGHT ONE
Exit For
End If
Next
End Sub