Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
デバッグフォルダからプログラムの.exeを実行しました。動作しましたが、閉じたときに、タスクマネージャーのプロセスリストにまだ表示されていることがわかりました。
これは私の最初のwinformsプログラムなので、一歩を忘れたに違いないと思います。
Mainメソッドのコードが次のようになっている限り、次のようになります。
Main
Application.Run(new MainForm());
次に、OKである必要があります(「MainForm」がメインフォームの名前であると想定)。WinFormsは、渡したフォームがApplication.Run閉じるとプロセスを終了します。
Application.Run
Application.Exit()それ以外の場合は、フォームの「Closed」イベントハンドラーで自分自身を呼び出すことができます。
Application.Exit()