ApplicationSettingsBase.SettingsSaving イベント
定義
データ ストアに値が保存される前に発生します。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
例
次のコード例は、 SettingsSavingからApplicationSettingsBase派生したラッパークラスFormSettings
である型のオブジェクトのイベントハンドラーを示しています。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. 完全なコード例についてはApplicationSettingsBase 、クラスの概要に記載されています。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
注釈
イベントは、アプリケーション設定のSaveプロパティを関連付けられたデータストアに格納する前に、メソッドによって発生します。 SettingsSavingThe 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.