Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 SettingChanging Event

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
ApplicationSettingsBase..::.SettingChanging Event

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

Namespace:  System.Configuration
Assembly:  System (in System.dll)
Visual Basic (Declaration)
Public Event SettingChanging As SettingChangingEventHandler
Visual Basic (Usage)
Dim instance As ApplicationSettingsBase
Dim handler As SettingChangingEventHandler

AddHandler instance.SettingChanging, handler
C#
public event SettingChangingEventHandler SettingChanging
Visual C++
public:
 event SettingChangingEventHandler^ SettingChanging {
    void add (SettingChangingEventHandler^ value);
    void remove (SettingChangingEventHandler^ value);
}
JScript
JScript does not support events.

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.

Visual Basic
Private Sub frmSettings1_SettingChanging(ByVal sender As Object, ByVal e As _
        SettingChangingEventArgs) Handles frmSettings1.SettingChanging
    tbStatus.Text = e.SettingName & ": " & e.NewValue.ToString
End Sub

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

Visual C++
private:
    void FormSettings_SettingChanging(Object^ sender,
        SettingChangingEventArgs^ e)
    {
        statusDisplay->Text = e->SettingName + ": " + e->NewValue;
    }

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker