I need my program To detect the resolution of multiple monitors on a system. I have figured out to get the resolution of one monitor.

Public Function ScreenResolution() As String
        Dim resX As Integer = Screen.PrimaryScreen.Bounds.Width
        Dim rexY As Integer = Screen.PrimaryScreen.Bounds.Height
        Return resX & " X " & resY
End Function

And I think I am pretty close to being able to get two or more monitors. I am believe I need to use something like this:

Public Function ScreenResolution() As String
       DIM resX As Integer = Screen.AllScreens(0).length
       DIM resy As Integer = Screen.AllScreens(0).Width
       Return resX & " X " & resY
End Function

However, its not working. I know I haven't quite nailed down the correct syntax for AllScreens. I have been trying to get this right all night. Any help would be appreciated.

Rab

OK So I have been able to figure out how to make it work.

Public Function ScreenResolution() As String

        Dim resX As Integer = Screen.AllScreens(0).Bounds.Width
        Dim resY As Integer = Screen.AllScreens(0).Bounds.Height
        Return resX & " X " & resY

End Function

seems to be working.

My next qeustion is, as this is my first function EVER how would I go about calling the function. What I plan on doing is comparing it to 1920 x 1080 and then throwing a message box that says pass or fail.

Also is there a way to include the monitor in the parameters ie: ScreenResolution(0) is monitor one, ScreenResolution(1) is monitor 2 ect wen I call the function?

Thank You again
Jon

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.