What's Here?
- Members: 109,722
- Replies: 414,706
- Topics: 63,079
- Snippets: 2,289
- Tutorials: 610
- Total Online: 1,894
- Members: 74
- Guests: 1,820
Who's Online?
|
Welcome to Dream.In.Code |
|
|
Getting VB.NET Help is Easy!
Join 109,722 VB.NET Programmers for FREE! Ask your question and get quick answers from experts. There are 1,894 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!
|
Enables to take advantage of multi-possessors.
|
Submitted By: m2s87
|
|
Rating:

|
|
Views: 7,728 |
Language: VB.NET
|
|
Last Modified: January 10, 2007 |
Instructions: Save it in a new class file
Write your code to the BackgroundWorker1_DoWork protsedure.
deklelare it like:
Dim x As New tee
start it like:
x.startBackgroundTask() |
Snippet
'written by Margus Martsepp AKA m2s87
Imports System.Threading
Public Class tee
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, _
ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
' Add your code here
End Sub
Private EndedAt As String, StartedAt As String
Private tegutseb As Boolean = False, Notifieonend As Boolean
Private WithEvents BackgroundWorker1 As New System.ComponentModel.BackgroundWorker
Public Sub startBackgroundTask() ' This will start the backgroundworker
tegutseb = True
StartedAt = "Started : " & Format(Now, "h:mm:ss") & "." & Now.Millisecond
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, _
ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) _
Handles BackgroundWorker1.RunWorkerCompleted ' Compleated
tegutseb = False
EndedAt = "Ended : " & Format(Now, "h:mm:ss") & "." & Now.Millisecond
If Notifieonend = True Then MsgBox(Timestamp, , "Protsess Done")
End Sub
Public ReadOnly Property Timestamp() As String
Get
Return StartedAt & Chr(13) & EndedAt
End Get
End Property
Public ReadOnly Property IsWorking() As Boolean
Get
Return tegutseb
End Get
End Property
Public Property Notifie_on_end() As Boolean
Get
Return Notifieonend
End Get
Set(ByVal value As Boolean)
Notifieonend = value
End Set
End Property
End Class
Copy & Paste
|
|
|
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|