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)

Source:
IUIService.cs
Source:
IUIService.cs
Source:
IUIService.cs

Displays the specified message in a message box.

C#
public void ShowMessage(string message);

Parameters

message
String

The message to display.

Examples

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

C#
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);

Remarks

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

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ShowMessage(String, String)

Source:
IUIService.cs
Source:
IUIService.cs
Source:
IUIService.cs

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

C#
public void ShowMessage(string message, string caption);

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.

C#
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);

Remarks

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

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ShowMessage(String, String, MessageBoxButtons)

Source:
IUIService.cs
Source:
IUIService.cs
Source:
IUIService.cs

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

C#
public System.Windows.Forms.DialogResult ShowMessage(string message, string caption, System.Windows.Forms.MessageBoxButtons buttons);

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.

C#
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);

Remarks

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

See also

Applies to

.NET Framework 4.8.1 i druge verzije
Proizvod Verzije
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10