The function ShowMessageBox shows a message box with either an OK button or Yes / No buttons.

Function Group Execution Windows Embedded Thin Client Mobile Access
ShowMessageBox Screen Synchronous Supported Supported Supported Supported (see “Notes” below)


Web Studio Help tions screen showmessagebox.xml d417896e137 ShowMessageBox
The message body that will be displayed in the box.
A numeric flag that specifies which kind of confirmation buttons to display in the message box:
Value Description
0 OK button
4 Yes / No buttons
Tip: To add an exclamation icon to the box — that is, to make it an alert or warning rather than a plain message — add 48 (vbExclamation) to this parameter. For more information, see “Examples” below.

This is an optional parameter. If no value is specified, then the default is 0.

The title of the message.

This is an optional parameter. If no value is specified, then no title will be displayed.

Returned value

This function returns the following possible values:
Value Description
0 Message box not displayed because the Viewer is not open; see “Notes” below.
1 User clicked OK.
6 User clicked Yes.
7 User clicked No.


Unlike other Screen functions, this function can be called from Global Procedures and Script worksheets, and when it is, the message box is displayed in the Viewer module on the project runtime server. If the Viewer module is not open — that is, if the Viewer task is not running — the message box cannot be displayed and the function returns 0.

When this function is used in project screens on Mobile Access, it has been enhanced to duplicate the functionality of the VBScript function MsgBox.

The following limitations also apply to how the function can be used in project screens in Mobile Access:
  • The function cannot be called from the sub-routine Screen_OnClose in the Screen Script; and
  • You should avoid creating a script that both shows a dialog box (e.g., a message box that is shown using the VBScript function MsgBox or the IWS built-in function ShowMessageBox) and opens or closes a screen. The Mobile Access web interface can display only one screen at a time, and opening a new screen will automatically close the previous one. Depending on the order of execution, this can lead to unexpected behavior such as a dialog box being orphaned or not being shown at all.


Display a plain message with an OK button:
  ShowMessageBox("The action could not be completed.")  
Display a question with Yes / No buttons:
  ShowMessageBox("Continue with action?",4)  
Display an alert with an OK button and a title:
  ShowMessageBox("The action could not be completed.",0+48,"Alert")