Get Screen Resolutions in

Posted on 2012-08-13
Last Modified: 2012-09-27
I'd like to determine the display resolution for each connected monitor in a multimonitor setup. It seems there are a few ways to do this, but I can't seem to find an example for implementing it in Thanks for your help!
Question by:Arrow_1
    LVL 35

    Expert Comment

    by:Robert Schutt
    I use this (adjusted from a routine found on the net) to determine the form size needed to cover all screens (for a screensaver):
            Dim EntireBounds As New Rectangle(0, 0, 0, 0)
            Dim scrn As Integer
            Dim TheScreens() As Screen = Screen.AllScreens
            For scrn = LBound(TheScreens) To UBound(TheScreens)
                If TheScreens(scrn).Bounds.X + TheScreens(scrn).Bounds.Width > EntireBounds.Width Then
                    EntireBounds.Width = TheScreens(scrn).Bounds.X + TheScreens(scrn).Bounds.Width
                End If
                If TheScreens(scrn).Bounds.Y + TheScreens(scrn).Bounds.Height > EntireBounds.Height Then
                    EntireBounds.Height = TheScreens(scrn).Bounds.Y + TheScreens(scrn).Bounds.Height
                End If
            Next scrn
            Me.Bounds = EntireBounds

    Open in new window

    The essence is the For Next loop, if you need to do something with each screen separately then inside the loop is the place to be ;-)
    LVL 27

    Accepted Solution

           For Each scrn As Screen In Screen.AllScreens
                Debug.Print(scrn.Bounds.Width & "x" & scrn.Bounds.Height)

    Open in new window

    LVL 13

    Author Closing Comment

    Simple and does exactly what I need.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now