BackgroundWorker.CancelAsync メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > BackgroundWorker.CancelAsync メソッドの意味・解説 

BackgroundWorker.CancelAsync メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

保留中のバックグラウンド操作のキャンセルを要求します。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

Dim instance As BackgroundWorker

instance.CancelAsync
public void CancelAsync ()
public:
void CancelAsync ()
public void CancelAsync ()
例外例外
例外の種類条件

InvalidOperationException

WorkerSupportsCancellation が false です。

解説解説
使用例使用例

CancelAsync メソッドを使用して、非同期 ("バックグラウンド") 操作をキャンセルするコード例を次に示します。このコード例は、BackgroundWorker クラスのトピックで取り上げているコード例の一部分です。

Private Sub cancelAsyncButton_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles cancelAsyncButton.Click
    
    ' Cancel the asynchronous operation.
    Me.backgroundWorker1.CancelAsync()

    ' Disable the Cancel button.
    cancelAsyncButton.Enabled = False
    
End Sub 'cancelAsyncButton_Click
private void cancelAsyncButton_Click(System.Object
 sender, 
    System.EventArgs e)
{   
    // Cancel the asynchronous operation.
    this.backgroundWorker1.CancelAsync();

    // Disable the Cancel button.
    cancelAsyncButton.Enabled = false;
}
void cancelAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
{  
   // Cancel the asynchronous operation.
   this->backgroundWorker1->CancelAsync();
   
   // Disable the Cancel button.
   cancelAsyncButton->Enabled = false;
}
private void cancelAsyncButton_Click(Object
 sender, System.EventArgs e)
{   
    // Cancel the asynchronous operation.
    this.backgroundWorker1.CancelAsync();

    // Disable the Cancel button.
    cancelAsyncButton.set_Enabled(false);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

BackgroundWorker.CancelAsync メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



BackgroundWorker.CancelAsync メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS