J
John Altland
Here is my basic problem. I have a form that executes a
cpu instensive algorithm occupying the first thread. When
the algorithm is executed another form pops up telling the
user the progress that has been made.
Whenever I attempt to update my frmProgress, the events
are put placed at the end of the thread's queue and
executed after my algorithm is finished. Using the
frmProgress.Label.Invoke method with delagates, I have
heard would fix this problem, however I have yet to reach
a resolution. Can anyone help me out. Here is the code.
Delegate Sub UpdateDelegate(ByVal updatefield As String)
Delegate Sub PaintForm()
Public Sub TextExtractor
Dim UploadForm As New UploadConfirm
Dim UpdateField As UpdateDelegate
Dim PF As PaintForm
PF = AddressOf UploadForm.Show
PF.Invoke()
UpdateField = AddressOf UploadForm.UpdateLabel
UploadForm.Label.Invoke(UpdateField.Invoke("Opening"))
Extract(filename)
filename.Open
UploadForm.Label.Invoke(UpdateField.Invoke("Extracting
Text from file"))
Dim str As String = GetText(filename)
UploadForm.Label.Invoke(UpdateField.Invoke("Sending
Text to Database") )
SendToDB(str)
UploadForm.Label.Invoke(UpdateField.Invoke("Finished
Uploading File"))
filename.Close
End Sub
.....
End Class
Class UploadConfirm
....
Public Sub UpdateLabel(ByVal str As String)
Me.Label.Text = str
End Sub
....
End Class
Thanks for any help
cpu instensive algorithm occupying the first thread. When
the algorithm is executed another form pops up telling the
user the progress that has been made.
Whenever I attempt to update my frmProgress, the events
are put placed at the end of the thread's queue and
executed after my algorithm is finished. Using the
frmProgress.Label.Invoke method with delagates, I have
heard would fix this problem, however I have yet to reach
a resolution. Can anyone help me out. Here is the code.
Delegate Sub UpdateDelegate(ByVal updatefield As String)
Delegate Sub PaintForm()
Public Sub TextExtractor
Dim UploadForm As New UploadConfirm
Dim UpdateField As UpdateDelegate
Dim PF As PaintForm
PF = AddressOf UploadForm.Show
PF.Invoke()
UpdateField = AddressOf UploadForm.UpdateLabel
UploadForm.Label.Invoke(UpdateField.Invoke("Opening"))
Extract(filename)
filename.Open
UploadForm.Label.Invoke(UpdateField.Invoke("Extracting
Text from file"))
Dim str As String = GetText(filename)
UploadForm.Label.Invoke(UpdateField.Invoke("Sending
Text to Database") )
SendToDB(str)
UploadForm.Label.Invoke(UpdateField.Invoke("Finished
Uploading File"))
filename.Close
End Sub
.....
End Class
Class UploadConfirm
....
Public Sub UpdateLabel(ByVal str As String)
Me.Label.Text = str
End Sub
....
End Class
Thanks for any help