ho risolto,basta fare il controllo al contrario,se cancello,controllo comunque la riga precedente e non devo gestire in maniera demoniaca indici
codice:rivate Sub CancellaSelBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancellaSelBtn.Click Dim i As Integer Dim cont As Integer = (Me.Turnides_TURNOLAVORATORIDataGridView.Rows.Count - 2) For i = cont To 0 Step -1 If (CBool(Me.Turnides_TURNOLAVORATORIDataGridView(Selezioneassegnati.Index, i).Value) = True) Then Dim codlavoratoredgv As Integer = CInt(Me.Turnides_TURNOLAVORATORIDataGridView(dgvColLavoratore.Index, i).Value) For Each row As movtestDataSet5.turnides_TURNOLAVORATORIRow In Me.MovtestDataSet5.turnides_TURNOLAVORATORI If row.RowState <> DataRowState.Deleted Then If row.LAVORATORE = codlavoratoredgv Then row.Delete() End If End If Next End If Next

ho risolto,basta fare il controllo al contrario,se cancello,controllo comunque la riga precedente e non devo gestire in maniera demoniaca indici
Rispondi quotando