Class
MobileMessageBox
Description
Used to asynchronously display alerts.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
Property descriptions
MobileMessageBox.LeftButton
LeftButton As String
The caption of the button on the left side of the dialog box.
This is a design-time-only property.
MobileMessageBox.Message
Message As String
A longer message that appears below the title in the message box.
Set the message:
MessageBox1.Message = "Would you like to update this information?"
MobileMessageBox.Name
Name As String
The name of the control.
MobileMessageBox.RightButton
RightButton As String
The caption of the button on the right side of the dialog box.
This is a design-time-only property.
MobileMessageBox.Title
Title As String
The title of the message box, which appears at the top.
Set the title:
MessageBox1.Title = "Warning"
Method descriptions
MobileMessageBox.Buttons
Buttons As String()
Gets the buttons for the message box.
Buttons(Assigns value() As String)
Sets the buttons for the message box.
Note
When there are only one or two buttons, they are shown side-by-side. The first button displays as bold. When there are more than two buttons, they are shown vertically. The first button added is the default and displays as bold at the bottom. The remaining buttons are in added in order an appear above the default button.
Displays a message box with multiple buttons. HelloMessage is an MobileMessageBox that was dragged onto the Screen from the Library:
HelloMessage.Title = "Hello"
HelloMessage.Message = "Hello, World!"
Var buttons() As String = Array("Yes", "No", "Maybe")
HelloMessage.Buttons = buttons
HelloMessage.Show
MobileMessageBox.Handle
Handle As Ptr
The handle to the underlying native OS control.
Important
This is supported for iOS only.
MobileMessageBox.Show
Show
Displays the message box. This is not modal, so your code continues to run. When the user selects a button, the Pressed event handler is called.
Displays a message box. HelloMessage is a MobileMessageBox that was dragged onto the Screen from the Library:
HelloMessage.Title = "Hello"
HelloMessage.Message = "Hello, World!"
HelloMessage.Show ' Not modal, so code does not pause here
Event descriptions
MobileMessageBox.Closing
Closing
Called when the control's layout is closing.
MobileMessageBox.Opening
Opening
Called when the control's layout is opening.
This is where you typically put initialization code.
This example in the Opening event of a label sets its text to "Hello":
Me.Text = "Hello"
MobileMessageBox.Pressed
Pressed(buttonIndex As Integer)
Called when the button at buttonIndex is selected.
Displays the index of the selected button:
Label1.Text = "You selected button " + buttonIndex.ToString
Notes
MobileMessageBox is asynchronous, any code after the Show method is executed after the message box is displayed. Use the Pressed event handler to get the results of a button selection and to run code based on the selection.
iOS UI guidelines
Apple provides user interface guidelines for the text and buttons in a MessageBox.
Compatibility
Mobile projects on all supported mobile operating systems.
See also
MobileControl parent class; MessageBox method, MobilePopupMessage class.