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: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds