Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

unable to center form on screen

Posted on 1999-01-15
2
Medium Priority
?
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
agrillage earned 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 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