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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「DoWorkEventArgs クラス」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS