Solved

unable to center form on screen

Posted on 1999-01-15
2
183 Views
Last Modified: 2010-05-03
I have a few forms (not full size) and I need it to be centered on the screen everytime it loads. The problem is the form always runs or appear randomly on the screen. How do I fix it so that it will appear in the center of the screen?

The smaller forms will call each other and I need to have my main form (maximize) behind it "disabled" until the smaller forms are clicked. I tried setting the smaller forms to Form1.show 1 but it only shows the smaller form without the main form behind it. How to solve this too?
0
Comment
Question by:ute
2 Comments
 
LVL 1

Accepted Solution

by:
agrillage earned 100 total points
ID: 1456584
If you are using VB5 or VB6 then your form has a startup position property. Set this to center of owner or center of screen. As for the other problem, try using an MDI form as your main form if you want the background window to manage the forms. Make the form's mdi child properties true for the front forms.
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1456585
Try this:

Private Sub Form_Load()
    Width = Screen.Width * 0.7
    Height = Screen.Height * 0.7
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question