ApplicationSettingsBase.SettingsSaving Evento

Definição

Ocorre antes de os valores serem guardados no armazenamento de dados.

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 de Evento

Exemplos

O exemplo de código seguinte mostra o SettingsSaving handler de eventos para um objeto do tipo FormSettings, que é uma classe de wrapper derivada de ApplicationSettingsBase. O handler interroga o utilizador para guardar os valores atuais das definições da aplicação. O exemplo completo do código está listado na ApplicationSettingsBase visão geral da 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 (DialogResult.No = dr) Then
        e.Cancel = True
    End If
End Sub

Observações

O SettingsSaving evento é gerado pelo Save método antes de este armazenar as propriedades das definições da aplicação no seu armazenamento de dados associado. O gestor de eventos associado pode cancelar este evento.

Aplica-se a

Ver também