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

Returns a NotificationSettings instance which exposes properties that control the way the end user is notified when validation of a single entity fails.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property NotificationSettings As NotificationSettings
C# 
public NotificationSettings NotificationSettings {get;}

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

The NotificationSettings property makes it possible to specify the manner in which the end user is notified of a failed validation. A NotificationSettings property is also exposed by the ValidationSettings class; property setting on that instance take precedence over settings on the instance returned by this property.

Note: The NotificationSettings property applies only to the validation of a single control or embeddable editor. Also note that the 'BalloonTip' setting is only applicable when the entity being validated has focus, as is the case when the ValidationTrigger is set to 'OnPropertyValueChanged', or when the RetainFocusOnError property is set to true.

See Also