Centering a Form on the Screen

Question:
How do I center a form on the monitor regardless of monitor resolution?

Answer:
The Screen object contains the properties of the current display. In the Form_Load event, you can use this code to center the form on the screen:

Me.Top = (Screen.Height – Me.Height) /2Me.Left = (Screen.Width – Me.Width) /2

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist