ApplicationSettingsBase.SettingsSaving Evento

Definición

Se produce antes de guardar los valores en el almacén de datos.

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

Ejemplos

En el ejemplo de código siguiente se muestra el controlador de eventos para el SettingsSaving objeto de tipo FormSettings, que es una clase contenedora derivada de ApplicationSettingsBase. El controlador consulta al usuario para guardar los valores de propiedad de configuración de la aplicación actuales. El ejemplo de código completo se muestra en la información general de la ApplicationSettingsBase clase.

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

Comentarios

El método genera el SettingsSavingSave evento antes de almacenar las propiedades de configuración de la aplicación en su almacén de datos asociado. El controlador de eventos asociado puede cancelar este evento.

Se aplica a

Consulte también