Infragistics(R) NetAdvantage(R) Windows Forms
MessageBoxIcon Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.Misc Namespace > UltraValidator Class : MessageBoxIcon Property

Gets/sets the value that is passed to the 'icon' parameter of the MessageBox.Show method when validation fails. Applicable only when the notification action resolves to 'MessageBox'.

Syntax

Visual Basic (Declaration) 
Public Property MessageBoxIcon As MessageBoxIcon
C# 
public MessageBoxIcon MessageBoxIcon {get; set;}

Example

The following code sample demonstrates how to use the MessageBoxIcon property in conjunction with some of the NotificationSettings properties to customize the way the end user is notified of a failed validation:

Visual BasicCopy Code
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports System.Drawing
Imports System.Drawing.Drawing2D

    Private Sub SetMessageBoxProperties(ByVal ultraValidator As UltraValidator)

        '  Set the MessageBoxIcon property to 'Information' so that
        '  failed validations are not quite as alarming as they are
        '  with the 'Error' setting.
        ultraValidator.MessageBoxIcon = MessageBoxIcon.Information

        '  Get a reference to the NotificationSettings instance which determines
        '  how notifications are handled for all controls associated with this
        '  UltraValidator instance.
        Dim notificationSettings As NotificationSettings = ultraValidator.NotificationSettings

        '  Set the Action property to 'MessageBox' so that a MessageBox
        '  is used to notify the end user of failed validations.
        notificationSettings.Action = NotificationAction.MessageBox

        '  Use the product name for the MessagBox's Caption
        notificationSettings.Caption = Application.ProductName

        '  Use the 'Asterisk' system sound for the audio notification
        notificationSettings.Sound = System.Media.SystemSounds.Asterisk
    End Sub
C#Copy Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Infragistics.Win;
using Infragistics.Win.Misc;
using System.Drawing;
using System.Drawing.Drawing2D;

    private void SetMessageBoxProperties( UltraValidator ultraValidator )
    {
        //  Set the MessageBoxIcon property to 'Information' so that
        //  failed validations are not quite as alarming as they are
        //  with the 'Error' setting.
        ultraValidator.MessageBoxIcon = MessageBoxIcon.Information;

        //  Get a reference to the NotificationSettings instance which determines
        //  how notifications are handled for all controls associated with this
        //  UltraValidator instance.
        NotificationSettings notificationSettings = ultraValidator.NotificationSettings;

        //  Set the Action property to 'MessageBox' so that a MessageBox
        //  is used to notify the end user of failed validations.
        notificationSettings.Action = NotificationAction.MessageBox;

        //  Use the product name for the MessagBox's Caption
        notificationSettings.Caption = Application.ProductName;

        //  Use the 'Asterisk' system sound for the audio notification
        notificationSettings.Sound = System.Media.SystemSounds.Asterisk;
    }

Remarks

Note: The MessageBoxIcon enumeration contains constants which have the same values but different names. For example, the 'Hand', 'Error', and 'Stop' constants all equate to the same integer value. The following table lists each of the named constants along with a brief description:
Constant(s) Description
None The message box contains no symbols.
Hand, Error, Stop The message box contains a symbol consisting of a white X in a circle with a red background.
Question The message box contains a symbol consisting of a question mark in a circle.
Exclamation, Warning The message box contains a symbol consisting of an exclamation point in a triangle with a yellow background.
Asterisk, Information The message box contains a symbol consisting of a lowercase letter i in a circle.

Also note that the 'Question' setting is included only for backward compatibility, and its use is no longer recommended because it does not clearly represent a specific type of message.

See Also