Hello Everyone,
I am working a project that have three grid two of them load excel sheet and one is to reconcile the data of both gird. I have button Reconcile When press its works fine. My problem is this I have to made some changes in second datagrid and again press on Reconcile button. But receive the above mention error my code snippiest is attached. I have used different ways to do it but no avail.
Dim I, J As Integer
Dim value1, value2 As Decimal
I = 0
J = 0
ID = 1
Dim newRow As DataRow
'Try
If ReconcileDataSet.Rows.Count = 0 Then
CreateReconcileDataTable()
End If
While I < LoadBankStatmentDataSet.Tables(0).Rows.Count
If NZ(LoadBankStatmentDataSet.Tables(0).Rows(I)(2)) = 1 Then
value1 = Convert.ToDecimal(LoadBankStatmentDataSet.Tables(0).Rows(I)(2))
While J < LoadCashBookDataSet.Tables(0).Rows.Count
If NZ(LoadCashBookDataSet.Tables(0).Rows(J)(4)) = 1 Then
value2 = Convert.ToDecimal(LoadCashBookDataSet.Tables(0).Rows(J)(4))
If value1 = value2 Then
newRow = ReconcileDataSet.NewRow
newRow.Item("DR") = value1
newRow.Item("ReconcileDate") = Me.ReconcileDateTimePicker.Value.Date
newRow.Item("ID") = ID
ReconcileDataSet.Rows.Add(newRow)
ID = ID + 1
J = LoadCashBookDataSet.Tables(0).Rows.Count 'Forcely break the loop
End If
End If
J = J + 1
End While
End If
J = 0
I = I + 1
End While
'If Me.DataGridViewRconcile.DataSource Is Nothing Then
'Else
' newDataSet.Tables.Remove("Reconcile")
' newDataSet.Tables.Add(ReconcileDataSet)
' Me.DataGridViewRconcile.DataSource = newDataSet.Tables("Reconcile")
'End If
newDataSet.Tables.Add(ReconcileDataSet.Copy())
Me.DataGridViewRconcile.DataSource = newDataSet.Tables("Reconcile")
'Me.newDataSet.
'Catch ex As Exception
' MsgBox(Err.Description)
'End Try
End Sub