Solved

unable to center form on screen

Posted on 1999-01-15
2
179 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now