ApplicationSettingsBase.SettingsSaving Evento

Definizione

Si verifica prima del salvataggio dei valori nell'archivio dati.

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

Tipo evento

Esempio

Nell'esempio di codice seguente viene illustrato il gestore eventi per l'oggetto SettingsSaving di tipo FormSettings, che è una classe wrapper derivata da ApplicationSettingsBase. Il gestore esegue una query sull'utente per salvare i valori delle proprietà delle impostazioni dell'applicazione correnti. L'esempio di codice completo è elencato nella panoramica della ApplicationSettingsBase classe.

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

Commenti

L'evento SettingsSaving viene generato dal Save metodo prima che archivii le proprietà delle impostazioni dell'applicazione nell'archivio dati associato. Il gestore eventi associato può annullare questo evento.

Si applica a

Vedi anche