I am trying to cycle throught all the rows in a DGV within a BGW but i can not get it to work this is what i have tried
RunWorkerAsync
Dowork
RunWorkerAsync
Code:
Me.CopyBGW.RunWorkerAsync(ItemsdatabaseDataGridView)
Code:
Private Sub CopyBGW_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles CopyBGW.DoWork
CopyBGW.WorkerSupportsCancellation = True
Dim DGV As Object = DirectCast(e.Argument, Object)
For Each row As DataGridViewRow In DGV.Rows
If DGV.RowCount > 0 Then
Dim MyDesiredIndex As Integer = 0
If DGV.CurrentRow.Index < IndexForm.ItemsdatabaseDataGridView.RowCount - 1 Then
MyDesiredIndex = DGV.CurrentRow.Index + 1
End If
DGV.ClearSelection()
DGV.CurrentCell = DGV.Rows(MyDesiredIndex).Cells(0)
DGV.Rows(MyDesiredIndex).Selected = True
End If
Dim Path As String = Item_pathTextBox.Text
Dim Dest As String = DFselectTextBox.Text
Dim Names As String = ItemnameTextBox.Text
File_Copy(Path, Dest, Names)
Next
End Sub