centering a form

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Scott Baxter (sbaxter_at_websearchstore.com)
Date: 07/11/04


Date: Sat, 10 Jul 2004 18:43:02 -0700

I have been trying to center a form on Windows 2000 using the following
subroutine:

Public Sub center(Anyform As Form)
Anyform.left = (Screen.Width - Anyform.Width) / 2
Anyform.tOp = (Screen.Height - Anyform.Height) / 2
DoEvents
End Sub

However, the form ends up on the lower right of the computer when
autostarted during windows startup.

If I run it in development mode, it works perfectly.

In startup mode the screen.height and width seem totally wrong.

What is the answer? Any help would be great.

Scott Baxter



Relevant Pages

  • Re: centering a form
    ... "Scott Baxter" wrote in message ... Public Sub center ... the form ends up on the lower right of the computer when: autostarted during windows startup. ... If I run it in development mode, ...
    (microsoft.public.vb.general.discussion)
  • Re: centering a form
    ... the same co-ordinates, so the end result will surely be the same? ... Public Sub center ... >: autostarted during windows startup. ... If I run it in development mode, ...
    (microsoft.public.vb.general.discussion)
  • Re: centering a form
    ... "Scott Baxter" wrote in message ... Public Sub center ... the form ends up on the lower right of the computer when: autostarted during windows startup. ... If I run it in development mode, ...
    (microsoft.public.vb.6.webdevelopment)
  • Re: centering a form
    ... the same co-ordinates, so the end result will surely be the same? ... Public Sub center ... >: autostarted during windows startup. ... If I run it in development mode, ...
    (microsoft.public.vb.6.webdevelopment)
  • centering a form
    ... I have been trying to center a form on Windows 2000 using the following ... Public Sub center ... autostarted during windows startup. ... If I run it in development mode, ...
    (microsoft.public.vb.general.discussion)