Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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.
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
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.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in