Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27212

cucle throught dgv rows inside BGW dowork

$
0
0
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
Code:

Me.CopyBGW.RunWorkerAsync(ItemsdatabaseDataGridView)
Dowork
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


Viewing all articles
Browse latest Browse all 27212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>