ApplicationSettingsBase.SettingsSaving Ereignis

Definition

Tritt ein, bevor Werte im Datenspeicher gespeichert werden.Occurs before values are saved to the data store.

public:
 event System::Configuration::SettingsSavingEventHandler ^ SettingsSaving;
public event System.Configuration.SettingsSavingEventHandler SettingsSaving;
member this.SettingsSaving : System.Configuration.SettingsSavingEventHandler 
Public Custom Event SettingsSaving As SettingsSavingEventHandler 

Ereignistyp

SettingsSavingEventHandler

Beispiele

Im folgenden Codebeispiel wird der- SettingsSaving Ereignishandler für das-Objekt des-Typs veranschaulicht FormSettings , das eine Wrapper Klasse ist, die von abgeleitet wird ApplicationSettingsBase .The following code example shows the SettingsSaving event handler for object of type FormSettings, which is a wrapper class derived from ApplicationSettingsBase. Der Handler fragt den Benutzer ab, um die aktuellen Eigenschaftswerte der Anwendungseinstellungen zu speichern.The handler queries the user to save the current application settings property values. Das vollständige Codebeispiel finden Sie in der ApplicationSettingsBase Übersicht über die-Klasse.The full code example is listed in the ApplicationSettingsBase class overview.

private:
    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;
        }
    }
void frmSettings1_SettingsSaving(object sender, CancelEventArgs e)
{
    //Should check for settings changes first.
    DialogResult dr = MessageBox.Show(
                    "Save current values for application settings?",
                    "Save Settings", MessageBoxButtons.YesNo);
    if (DialogResult.No == dr)
    {
        e.Cancel = true;
    }
}
Private Sub frmSettings1_SettingsSaving(ByVal sender As Object, ByVal e As _
        CancelEventArgs) Handles frmSettings1.SettingsSaving
    'Should check for settings changes first.
    Dim dr As DialogResult = MessageBox.Show( _
        "Save current values for application settings?", "Save Settings", _
        MessageBoxButtons.YesNo)
    If (System.Windows.Forms.DialogResult.No = dr) Then
        e.Cancel = True
    End If
End Sub

Hinweise

Das- SettingsSaving Ereignis wird von der- Save Methode ausgelöst, bevor die Eigenschaften der Anwendungseinstellungen in Ihrem zugeordneten Datenspeicher gespeichert werden.The SettingsSaving event is raised by the Save method before it stores the application settings properties to their associated data store. Der zugehörige Ereignishandler kann dieses Ereignis abbrechen.The associated event handler can cancel this event.

Gilt für:

Siehe auch