Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Center a form


'Do not try to center If maximized or minimized
If frmMain.WindowState = vbMinimized Or frmMain.WindowState = vbMaximized Then
   frmMain.Move (Screen.Width - frmMain.Width) / 2, (Screen.Height - frmMain.Height) / 2
End If