Version

Sound Property (NotificationSettings)

Gets/sets the full path to a sound file, URL, SystemSound, or the value of a constant from the SoundEvents enumeration which is played when the end user is notified of a failed validation.
Syntax
'Declaration
 
Public Property Sound As Object
public object Sound {get; set;}
Remarks

Note: The Sound property only accepts values of type string, SystemSound, SoundEvents, and Stream; specifying a value of any other type will cause an exception to be thrown. A string value must contain a valid file path or URL; if the file or URL cannot be located, a Beep is played. If a stream is assigned to the property, it must contain valid waveform audio data (i.e., from a .WAV file).

p>

If the Sound property contains a string which does not reference a valid sound file, the default system sound is played.

Not all constants from the SoundEvents enumeration, or all system sounds are supported on any given local machine; which sounds are available is a function of the local machine's operating system and/or configuration.

If the specified sound is not available on the local machine, a Beep is played.

The sound is played asynchronously, i.e., the thread on which the notification is issued is not blocked while the sound is played.

When the notification action resolves to 'SoundOnly', and the Sound property has not been explicitly set, a Beep is played.

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:

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
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;
    }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also