devxlogo

Centering a Form on the Screen

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

devx-admin

Share the Post: