Bewerken

Delen via


IUIService.ShowMessage Method

Definition

Displays the specified message in a message box.

Overloads

ShowMessage(String)

Displays the specified message in a message box.

ShowMessage(String, String)

Displays the specified message in a message box with the specified caption.

ShowMessage(String, String, MessageBoxButtons)

Displays the specified message in a message box with the specified caption and buttons to place on the dialog box.

ShowMessage(String)

Displays the specified message in a message box.

public:
 void ShowMessage(System::String ^ message);
public void ShowMessage (string message);
abstract member ShowMessage : string -> unit
Public Sub ShowMessage (message As String)

Parameters

message
String

The message to display.

Examples

The following code example demonstrates how to use the ShowMessage method to display a message box.

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowMessage("Test message", "Test caption", 
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore);
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowMessage("Test message", "Test caption", _
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore)
End If

Remarks

This method ensures that the display of the message box is properly integrated with the development environment.

Applies to

ShowMessage(String, String)

Displays the specified message in a message box with the specified caption.

public:
 void ShowMessage(System::String ^ message, System::String ^ caption);
public void ShowMessage (string message, string caption);
abstract member ShowMessage : string * string -> unit
Public Sub ShowMessage (message As String, caption As String)

Parameters

message
String

The message to display.

caption
String

The caption for the message box.

Examples

The following code example attempts to obtain an instance of the IUIService and invoke the service's ShowMessage method.

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowMessage("Test message", "Test caption", 
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore);
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowMessage("Test message", "Test caption", _
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore)
End If

Remarks

This method ensures that the display of the message box is properly integrated with the development environment.

Applies to

ShowMessage(String, String, MessageBoxButtons)

Displays the specified message in a message box with the specified caption and buttons to place on the dialog box.

public:
 System::Windows::Forms::DialogResult ShowMessage(System::String ^ message, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons);
public System.Windows.Forms.DialogResult ShowMessage (string message, string caption, System.Windows.Forms.MessageBoxButtons buttons);
abstract member ShowMessage : string * string * System.Windows.Forms.MessageBoxButtons -> System.Windows.Forms.DialogResult
Public Function ShowMessage (message As String, caption As String, buttons As MessageBoxButtons) As DialogResult

Parameters

message
String

The message to display.

caption
String

The caption for the dialog box.

buttons
MessageBoxButtons

One of the MessageBoxButtons values: OK, OKCancel, YesNo, or YesNoCancel.

Returns

One of the DialogResult values indicating the result code returned by the dialog box.

Examples

The following code example demonstrates how to use the ShowMessage method to display a message box.

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowMessage("Test message", "Test caption", 
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore);
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowMessage("Test message", "Test caption", _
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore)
End If

Remarks

This method ensures that the display of the message box is properly integrated with the development environment.

See also

Applies to