I'm having trouble with the code below. The error I'm receiving is "Option Strict On prohibits operands of type Object for operator '+' on the 'dRows(0)("Ordered") += dRows(x)("Ordered")' and 'dRows(0)("Shipped") += dRows(x)("Shipped")' lines. Option Strict Off works, but I'd like not to find a bug later on. Any suggestions that would point me in the right direction?
Code:
Dim dr As DataRow
Dim pNoList As New List(Of String)
For Each dr In ProductData.Tables("Invoice").Rows
If pNoList.Contains(CStr(dr("Part"))) = False Then
pNoList.Add(CStr(dr("Part")))
End If
Next
Dim dRows As DataRow()
For Each pNo In pNoList
dRows = ProductData.Tables("Invoice").Select("Part = '" & pNo.ToString & "'")
For x = dRows.Count - 1 To 1 Step -1
dRows(0)("Ordered") += dRows(x)("Ordered")
Next
For x = dRows.Count - 1 To 1 Step -1
dRows(0)("Shipped") += dRows(x)("Shipped")
dRows(x).Delete()
Next
Next