Export (0) Print
Expand All

ApplicationSettingsBase.SettingChanging Event

Occurs before the value of an application settings property is changed.

Namespace:  System.Configuration
Assembly:  System (in System.dll)

public event SettingChangingEventHandler SettingChanging

The SettingChanging event occurs before an application setting value property is changed through the Item method. This event is not raised when the Reload or Reset methods are called. SettingChanging can be canceled through the SettingChangingEventArgs event data class.

You typically use the SettingChanging event to handle immediate validation of an individual settings property. For more information about validation, see How to: Validate Application Settings.

There is no corresponding SettingChanged event for this class; instead, see the PropertyChanged event.

The following code example shows the SettingChanging event handler for object of type FormSettings, which is a wrapper class derived from ApplicationSettingsBase. The handler displays the event information in a textbox named tbStatus. The full code example is listed in the ApplicationSettingsBase class overview.

void frmSettings1_SettingChanging(object sender, SettingChangingEventArgs e)
{
    tbStatus.Text = e.SettingName + ": " + e.NewValue;
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft