ApplicationSettingsBase.SettingsSaving Event

Note: This event is new in the .NET Framework version 2.0.

Occurs before values are saved to the data store.

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

event SettingsSavingEventHandler^ SettingsSaving {
	void add (SettingsSavingEventHandler^ value);
	void remove (SettingsSavingEventHandler^ value);

/** @event */
public void add_SettingsSaving (SettingsSavingEventHandler value)

/** @event */
public void remove_SettingsSaving (SettingsSavingEventHandler value)

JScript supports the use of events, but not the declaration of new ones.

The SettingsSaving event is raised by the Save method before it stores the application settings properties to their associated data store. The associated event handler can cancel this event.

The following code example shows the SettingsSaving event handler for object of type FormSettings, which is a wrapper class derived from ApplicationSettingsBase. The handler queries the user to save the current application settings property values. The full code example is listed in the ApplicationSettingsBase class overview.

    void FormSettings_SettingsSaving(Object^ sender,
        CancelEventArgs^ e)
        //Should check for settings changes first.
        ::DialogResult^ dialogResult = MessageBox::Show(
            "Save current values for application settings?",
            "Save Settings", MessageBoxButtons::YesNo);
        if (::DialogResult::No == dialogResult)
            e->Cancel = true;

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

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

.NET Framework

Supported in: 2.0

Community Additions