A method to reposition standard MsgBox windows from VB

This code allows you to reposition the standard MsgBox window. To use it in your program simply replace all calls to the standard MsgBox routine with a call to MsgBoxEx

The new routine has the following Format:


'
public Function MsgBoxEx(Prompt, optional X = -1, optional Y = -1, _
     optional StartupPosition as StartupPos = CenterScreen, _
     optional Buttons as VbMsgBoxStyle = vbOKOnly, optional Title, _
     optional HelpFile, optional Context) as VbMsgBoxResult
'
'

You can specify the startup x and y positions or even whether the message box is centered to the screen or the calling form.

Download Sample Project (3k)



Comments

  • Good

    Posted by Legacy on 05/22/2002 12:00am

    Originally posted by: George

    Well not for experts but for newbies

    Reply
  • Suggestion on the order of the parameters

    Posted by Legacy on 04/25/2000 12:00am

    Originally posted by: Anonymous

    This is quite useful and handy. It's just a small thing but it is probably better to define the signature as follows:

    MsgBoxEx(Prompt, Optional Buttons As VbMsgBoxStyle = vbOKOnly, Optional Title, Optional HelpFile, Optional context, Optional StartupPosition As StartupPos = CenterScreen, Optional x = -1, Optional Y = -1) As VbMsgBoxResult

    Regards

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • Due to internal controls and regulations, the amount of long term archival data is increasing every year. Since magnetic tape does not need to be periodically operated or connected to a power source, there will be no data loss because of performance degradation due to the drive actuator. Read this white paper to learn about a series of tests that determined magnetic tape is a reliable long-term storage solution for up to 30 years.

Most Popular Programming Stories

More for Developers

RSS Feeds