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

  • Targeted attacks and advanced threats are customized to infiltrate your unique IT infrastructure, evade conventional defenses, and remain hidden while stealing your corporate data. To detect these criminal intrusions, analysts and security experts agree that organizations should deploy advanced threat protection as part of an expanded security monitoring strategy. For this comparative analysis of breach detection systems, product analysis reports and comparative analysis reports are used to create the security …

  • Not all enterprise applications are created equal. Sophisticated applications need developer support but other more basic apps do not. With the right tools, everyone is a potential app developer with ideas and a perspective to share. Trends such as low-code development and model driven development are fundamentally changing how and who creates applications. Is your organization ready? Read this report and learn: The seven personas of enterprise app delivery How application ownership is spreading to the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds