B28zs‖MsgBox Function

Contents
Rzq5e‖

# wDArK‖MsgBox Function

27uTq‖Displays a dialog box containing a message and returns a value.

### FVEx2‖Syntax:

    MsgBox (Prompt As String [,Buttons = MB_OK [,Title As String]]) As Integer

### WADQ4‖Parameters:

DGAJA‖ prompt: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).

stGAc‖ title: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.

nARDU‖ buttons: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. buttons represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:

Bf6za‖Named constant | 77fDA‖Integer value | oGbBz‖Definition
--- | --- | ---
MB_OK | 0 | vymRc‖Display OK button only.
MB_OKCANCEL | 1 | mRRGS‖Display OK and Cancel buttons.
MB_ABORTRETRYIGNORE | 2 | dTHCd‖Display Abort, Retry, and Ignore buttons.
MB_YESNOCANCEL | 3 | ACrFj‖Display Yes, No, and Cancel buttons.
MB_YESNO | 4 | GtCAu‖Display Yes and No buttons.
MB_RETRYCANCEL | 5 | UREcH‖Display Retry and Cancel buttons.
MB_ICONSTOP | 16 | Fd4PG‖Add the Stop icon to the dialog.
MB_ICONQUESTION | 32 | yfaDF‖Add the Question icon to the dialog.
MB_ICONEXCLAMATION | 48 | ANc5p‖Add the Exclamation Point icon to the dialog.
MB_ICONINFORMATION | 64 | AtuHu‖Add the Information icon to the dialog.
| 128 | gDmyx‖First button in the dialog as default button.
MB_DEFBUTTON2 | 256 | JHgX7‖Second button in the dialog as default button.
MB_DEFBUTTON3 | 512 | trCb5‖Third button in the dialog as default button.

### bBBqF‖Return type:

KNkK6‖Integer

iFbrx‖Named constant | EsT4B‖Integer value | uNtKZ‖Definition
--- | --- | ---
IDOK | 1 | VU7tJ‖ OK
IDCANCEL | 2 | EahqB‖ Cancel
IDABORT | 3 | MJQuz‖ Abort
IDRETRY | 4 | BzmDt‖ Retry
IDIGNORE | 5 | P9UpS‖ Ignore
IDYES | 6 | AGhUx‖ Yes
IDNO | 7 | unSkB‖ No

### SEjHR‖Error codes:

5 Invalid procedure call

## TCdv9‖Example:

    Sub ExampleMsgBox
    Dim sVar As Integer
    XvLKP‖ sVar = MsgBox("Las Vegas")
    pquAz‖ sVar = MsgBox("Las Vegas",1)
    aNYKh‖ sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Dialog title")
    voH2H‖ sVar = MsgBox("Las Vegas", MB_DEFBUTTON2 + MB_ICONSTOP + MB_ABORTRETRYIGNORE, "Dialog title")
    End Sub

Please support us!