Centering a message box

Posted on 1998-12-03
Last Modified: 2010-05-03
My application displays a window in the middle of the screen, not full size. the problem is when I call the MsgBox function the message box dialog displayes slightly below my apps window. Is there a way to center the message box window with respect to my application window?
Thank in Advance.
Question by:BlackRussian
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

Accepted Solution

Dalin earned 100 total points
ID: 1447990
You need to to make your own message box.
Just add anew form, call it frmMessage. Put a lable to display the message with a couple of command buttons.
When you need to display the message box, add
frmMessage.Show vbModal

You can control the position, font, back color, and add some animation in it.
Let me know if I can be more help
LVL 14

Expert Comment

ID: 1447991
Here is a link showing you how to center a Common Dialog - The Easy and the Hard Way

LVL 14

Expert Comment

ID: 1447992
Here is a link showing you how to center a Common Dialog - The Easy and the Hard Way


Expert Comment

ID: 1447993
You can try tweak with the original MessageBox API, which allows you to specify a parent window, and supposed to align it properly

Expert Comment

ID: 1447994
here is a very good example with code from MSDN article Q180936.
URL is: 

let me know if this helps,

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

631 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