home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_MakeanAsynchronousMethodCall_snippet_142545_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  2KB  |  43 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Make an Asynchronous Method Call</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Makes an asynchronous method call using the BackgroundWorker component.</Description>
  8.       <Shortcut>appAsynchMeth</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <Imports>
  12.         <Import>
  13.           <Namespace>Microsoft.VisualBasic</Namespace>
  14.         </Import>
  15.         <Import>
  16.           <Namespace>System.Threading</Namespace>
  17.         </Import>
  18.       </Imports>
  19.       <Declarations>
  20.         <Object>
  21.           <ID>backgroundWorkerInstance</ID>
  22.           <Type>System.ComponentModel.BackgroundWorker</Type>
  23.           <ToolTip>BackgroundWorker component instance to manage the background thread.  Can be created by dragging a BackgroundWorker component instance from the Toolbox.</ToolTip>
  24.           <Default>BackgroundWorker1</Default>
  25.         </Object>
  26.       </Declarations>
  27.       <Code Language="VB" Kind="method decl"><![CDATA[    Private Sub startBackgroundTask()
  28.         ' Execute the Background Task
  29.         $backgroundWorkerInstance$.RunWorkerAsync()
  30.     End Sub
  31.  
  32.     Private Sub $backgroundWorkerInstance$_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles $backgroundWorkerInstance$.DoWork
  33.         ' This method will execute in the background thread created by the BackgroundWorker componet
  34.  
  35.     End Sub
  36.  
  37.     Private Sub $backgroundWorkerInstance$_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles $backgroundWorkerInstance$.RunWorkerCompleted
  38.         ' This event fires when the DoWork event completes
  39.  
  40.     End Sub]]></Code>
  41.     </Snippet>
  42.   </CodeSnippet>
  43. </CodeSnippets>