ShowMessage method (WinStudio scripts)

Applies To

IWSApplication interface

Definition

Displays a string in a message box, waits for the user to click a button, and then returns an integer indicating which button the user clicked.

Syntax

Application.ShowMessage( string [, style ] )

  Part   Description
string Required. The "prompt" string, containing the text to be displayed as the message in the box.
style Optional. Visual Basic MsgBoxStyle setting that determines what buttons and icon are displayed in the message box.

For more information, see the "Message Box Style Settings" section later in this topic.

Remarks

This method provides the same type of functionality as the MsgBox function in Visual Basic. This method is designed to support various locale settings for international compatibility by reconciling the current system default locale with the font setting to display messages properly.

The prompt string (string1) can be a combination of literal and variable values, as in this example:

    ("The RGB code for your default form background color is " & defColor)

To concatenate string parts, use the ampersand (&) character.

This method does not support a Help button for context-sensitive help.

For more information, including button parameters and return values, see the online Help for the Visual Basic MsgBox function.

Message box style settings

This table lists the message box style (MsgBoxStyle) options, how the system presents each, and the return values for each button.

Option Buttons Description / Comments
AbortRetryIgnore Abort

Retry

Ignore

Equivalent to vbAbortRetryIgnore.
ApplicationModal OK Equivalent to vbApplicationModal.
Critical OK Equivalent to vbCritical.
DefaultButton1 OK Equivalent to vbDefaultButton1.
DefaultButton2 OK Equivalent to vbDefaultButton2.
DefaultButton3 OK Equivalent to vbDefaultButton3.
Exclamation OK Equivalent to vbExclamation.
Information OK Equivalent to vbInformation.
MsgBoxHelp OK Equivalent to vbMsgBoxHelp.
MsgBoxRight OK Equivalent to vbMsgBoxRight.
MsgBoxRtlReading OK Equivalent to vbMsgBoxRtlReading.
MsgBoxSetForeground OK Equivalent to vbMsgBoxSetForeground.
OkCancel OK

Cancel

 
OkOnly OK  
Question OK Equivalent to vbQuestion.
RetryCancel Retry

Cancel

Equivalent to vbRetryCancel.
SystemModal OK Equivalent to vbSystemModal.
YesNo Yes

No

With this style, the close message box button is disabled.

Equivalent to vbYesNo.

YesNoCancel Yes

No

Cancel

Equivalent to vbYesNoCancel.

Example

Sub MsgBox()
   Dim defColor As String
   defColor = Application.GetUserPreferenceValue("BaseFormBackColorDescriptor")
   Application.ShowMessage("The RGB code for your default form background color is: " & defColor)
End Sub