DoWorkEventArgsとは? わかりやすく解説

DoWorkEventArgs クラス

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

DoWork イベント ハンドラデータ提供します

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

Public Class DoWorkEventArgs
    Inherits CancelEventArgs
Dim instance As DoWorkEventArgs
public class DoWorkEventArgs : CancelEventArgs
public ref class DoWorkEventArgs : public
 CancelEventArgs
public class DoWorkEventArgs extends CancelEventArgs
public class DoWorkEventArgs extends
 CancelEventArgs
解説解説
使用例使用例

DoWorkEventArgs クラス使用して DoWork イベント処理する方法を示すコード例次に示します。完全なコードの一覧については、「方法 : バックグラウンド操作実行する」を参照してください

Private Sub backgroundWorker1_DoWork( _
sender As Object, e As DoWorkEventArgs)
 _
Handles backgroundWorker1.DoWork

   ' Do not access the form's BackgroundWorker reference directly.
   ' Instead, use the reference provided by the sender parameter.
   Dim bw As BackgroundWorker = CType( sender,
 BackgroundWorker )
   
   ' Extract the argument.
   Dim arg As Integer =
 Fix(e.Argument)
   
   ' Start the time-consuming operation.
   e.Result = TimeConsumingOperation(bw, arg)
   
   ' If the operation was canceled by the user, 
   ' set the DoWorkEventArgs.Cancel property to true.
   If bw.CancellationPending Then
      e.Cancel = True
   End If

End Sub   
private void backgroundWorker1_DoWork(object
 sender, DoWorkEventArgs e)
{
    // Do not access the form's BackgroundWorker reference directly.
    // Instead, use the reference provided by the sender parameter.
    BackgroundWorker bw = sender as BackgroundWorker;

    // Extract the argument.
    int arg = (int)e.Argument;

    // Start the time-consuming operation.
    e.Result = TimeConsumingOperation(bw, arg);

    // If the operation was canceled by the user, 
    // set the DoWorkEventArgs.Cancel property to true.
    if (bw.CancellationPending)
    {
        e.Cancel = true;
    }
}
継承階層継承階層
System.Object
   System.EventArgs
     System.ComponentModel.CancelEventArgs
      System.ComponentModel.DoWorkEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DoWorkEventArgs コンストラクタ


DoWorkEventArgs プロパティ


DoWorkEventArgs メソッド


DoWorkEventArgs メンバ

DoWork イベント ハンドラデータ提供します

DoWorkEventArgs データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DoWorkEventArgs DoWorkEventArgs クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DoWorkEventArgs クラス
System.ComponentModel 名前空間
BackgroundWorker クラス

その他の技術情報

方法 : バックグラウンド操作実行する



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DoWorkEventArgs」の関連用語

DoWorkEventArgsのお隣キーワード
検索ランキング

   

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



DoWorkEventArgsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS