Center Align a Form - Vb.net

center a form

Snippet Code


  
Rate this page :
  [ 0 votes]

This code shows how to center a form on screen

Private Sub Form_Load() me.move (Screen.Width - me.Width) / 2, _ (Screen.Height - me.Height) / 2 End Sub 'OR: As a reusable function (oForm = form to center): Public Sub CenterForm(oForm as Object) on error resume next oForm.move (Screen.width - oForm.width) / 2, _ (Screen.Height - oForm.Height) / 2 End Sub

Tags


Ask Questions

Ask Question