Upraviť

Zdieľať cez


ApplicationSettingsBase.SettingChanging Event

Definition

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

public:
 event System::Configuration::SettingChangingEventHandler ^ SettingChanging;
public event System.Configuration.SettingChangingEventHandler SettingChanging;
member this.SettingChanging : System.Configuration.SettingChangingEventHandler 
Public Custom Event SettingChanging As SettingChangingEventHandler 

Event Type

Examples

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.

private:
    void FormSettings_SettingChanging(Object^ sender,
        SettingChangingEventArgs^ e)
    {
        statusDisplay->Text = e->SettingName + ": " + e->NewValue;
    }
void frmSettings1_SettingChanging(object sender, SettingChangingEventArgs e)
{
    tbStatus.Text = e.SettingName + ": " + e.NewValue;
}
Private Sub frmSettings1_SettingChanging(ByVal sender As Object, ByVal e As _
        SettingChangingEventArgs) Handles frmSettings1.SettingChanging
    tbStatus.Text = e.SettingName & ": " & e.NewValue.ToString
End Sub

Remarks

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.

Applies to

See also