Skale
asked on
Backgroundworker doesn't works in my vb.net application
I'm trying to use background worker but i didn't succeeded. It didin't perform anything. I'm a bit newbie about background worker topic.
So i'll be glad for any help. Thanks.
This is RunWorkerAsync() when i clicked my run button.
This is .DoWork() i'm calling it from another class
This is my DoWork code which i runned from another class.
So i'll be glad for any help. Thanks.
This is RunWorkerAsync() when i clicked my run button.
Private Sub CheckRun(sender As Object, e As EventArgs) Handles cmdModuleCheck_run.Click
bgWorkCheck.RunWorkerAsync()
End Sub
This is .DoWork() i'm calling it from another class
Private Sub DoWorkCheck(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles bgWorkCheck.DoWork
ModuleCheck.LocalTools.RunCheck(Globals.SpckModel)
End Sub
This is my DoWork code which i runned from another class.
Public Shared Sub RunCheck(ByVal mdl As IScrModel)
Dim tView As TreeView = GUI.treCheckListMain
Dim dgView As DataGridView = GUI.dgvCheckInfo
dgView.Rows.Clear()
For Each nodeParent As TreeNode In tView.Nodes
For Each nodeChild As TreeNode In nodeParent.Nodes
If nodeChild.Checked = True Then
dgView.Rows.Add(nodeParent.Text, nodeChild.Text, "In queue")
End If
Next
Next
If tView.Nodes.Item("nodBody").Nodes.Item("nodBodyComp").Checked = True Then
Dim rowIndex As Integer = FindRowDgv(tView.Nodes.Item("nodBody").Text, tView.Nodes.Item("nodBody").Nodes.Item("nodBodyComp").Text)
Try
StyleStatus(rowIndex, "Performing", Color.Yellow)
Body.ListBodies(mdl, GUI.GetRecursive(GUI.cboCheckBodyComputed_recur.SelectedIndex), GUI.dgvCheckBodyComputed)
StyleStatus(rowIndex, "Finished", Color.Green)
Catch ex As Exception
StyleStatus(rowIndex, "Error Occured", Color.Red)
Tools.OutputLog.Print(Tools.OutputLog.Type.ERR, ex.Message)
End Try
End If
If tView.Nodes.Item("nodMarker").Nodes.Item("nodMarkerComp").Checked = True Then
Dim rowIndex As Integer = FindRowDgv(tView.Nodes.Item("nodMarker").Text, tView.Nodes.Item("nodMarker").Nodes.Item("nodMarkerComp").Text)
Try
StyleStatus(rowIndex, "Performing", Color.Yellow)
Marker.ListMarkers(mdl, GUI.GetRecursive(GUI.cboCheckMarkerPosition_recur.SelectedIndex), GUI.dgvCheckMarkerPosition)
StyleStatus(rowIndex, "Finished", Color.Green)
Catch ex As Exception
StyleStatus(rowIndex, "Error Occured", Color.Red)
Tools.OutputLog.Print(Tools.OutputLog.Type.ERR, ex.Message)
End Try
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.