📚 SAP Business One SDK Help

MessageBox Method
See Also  Example
Text
The message
DefaultBtn
The default button of the message box, either 1, 2, or 3
Btn1Caption
The caption of the first button
Btn2Caption
The caption of the second button
Btn3Caption
The caption of the third button

Description

Sends a modal message box to the SAP Business One application.

Syntax

Visual Basic
Public Function MessageBox( _
   ByVal Text As String, _
   Optional ByVal DefaultBtn As Long = 1, _
   Optional ByVal Btn1Caption As String = "Ok", _
   Optional ByVal Btn2Caption As String = "", _
   Optional ByVal Btn3Caption As String = "" _
) As Long

Parameters

Text
The message
DefaultBtn
The default button of the message box, either 1, 2, or 3
Btn1Caption
The caption of the first button
Btn2Caption
The caption of the second button
Btn3Caption
The caption of the third button

Return Type

The index of the button that was clicked

Remarks

For more information on creating message boxes, see the SAP Business One Standard and Guidelines for User Interface.

Example

Displaying a message box (Visual Basic)Copy Code
'MessageBox return value (the index of the button pressed, 1 based).
Dim iReturnValue As Integer

iReturnValue = MessageBox("Do you want to continue?", 3, "&Yes!", "&No", "&Maybe")

Select Case iReturnValue
    Case 1:
        'continue
    Case 2:
        'abort
    Case 3:
        'Maybe pressed
End Select

See Also