WindowsFormsApplicationBase.Shutdown イベント
定義
アプリケーションの終了時に発生します。Occurs when the application shuts down.
public:
event Microsoft::VisualBasic::ApplicationServices::ShutdownEventHandler ^ Shutdown;
public event Microsoft.VisualBasic.ApplicationServices.ShutdownEventHandler Shutdown;
member this.Shutdown : Microsoft.VisualBasic.ApplicationServices.ShutdownEventHandler
Public Event Shutdown As ShutdownEventHandler
例
この例では、アプリケーションのシャットダウン時にメッセージをログに記録します。This example logs messages when the application shuts down.
Private Sub MyApplication_Shutdown(
sender As Object,
e As System.EventArgs
) Handles Me.Shutdown
My.Application.Log.WriteEntry("Application Shut Down.")
End Sub
アプリケーションイベントのコードエディターウィンドウにコードを入力する必要があります。You must enter the code in the Code Editor window for application events. このウィンドウにアクセスするには、このトピックの「解説」に記載されている手順に従ってください。To access this window, follow the instructions from this topic's Remarks section. 詳細については、アプリケーションの起動時またはシャットダウン時にメッセージをログに記録ます。For more information, see How to: Log Messages When the Application Starts or Shuts Down.
注釈
アプリケーションは、終了する前に Shutdown
イベントを発生させます。An application raises the Shutdown
event before it exits. これにより、アプリケーションがリソースを閉じる方法を制御できます。This allows you to control how the application closes its resources. このイベントは、Visual Basic アプリケーションモデルの一部です。This event is part of the Visual Basic Application model. 詳細については、「 Visual Basic アプリケーションモデルの概要」を参照してください。For more information, see Overview of the Visual Basic Application Model.
Shutdown
イベントハンドラーのコードは、既定では非表示になっている ApplicationEvents .vb ファイルに格納されます。The code for the Shutdown
event handler is stored in the ApplicationEvents.vb file, which is hidden by default.
アプリケーションイベントのコードエディターウィンドウにアクセスするにはTo access the Code Editor window for application events |
1.ソリューションエクスプローラーでプロジェクトを選択し、[プロジェクト] メニューの [プロパティ] をクリックします。1. With a project selected in Solution Explorer, click Properties on the Project menu. 2.[アプリケーション] タブをクリックします。2. Click the Application tab. 3.[アプリケーション イベントの表示] をクリックしてコード エディターを開きます。3. Click the View Application Events button to open the Code Editor. 詳細については、「[アプリケーション] ページ (プロジェクト デザイナー) (Visual Basic)」を参照してください。For more information, see Application Page, Project Designer (Visual Basic). |
プロジェクトの種類別の可用性Availability by Project Type
プロジェクトの種類Project type | 使用可能Available |
---|---|
Windows フォーム アプリケーションWindows Forms Application | はいYes |
クラス ライブラリClass Library | いいえNo |
コンソール アプリケーションConsole Application | いいえNo |
Windows フォーム コントロール ライブラリWindows Forms Control Library | いいえNo |
Web コントロールライブラリWeb Control Library | いいえNo |
Windows サービスWindows Service | いいえNo |
Web サイトWeb Site | いいえNo |
適用対象
こちらもご覧ください
- EventArgs
- オブジェクト (Visual Basic)Objects (Visual Basic)
- 方法 : アプリケーションの起動時または終了時にメッセージをログに記録するHow to: Log Messages When the Application Starts or Shuts Down
- Application Page, Project Designer (Visual Basic)Application Page, Project Designer (Visual Basic)
- Visual Basic アプリケーション モデルの概要Overview of the Visual Basic Application Model