It seems that every time if i need to update my current line's serial no. , i need to remove all existing serial no. before i can assign the new list of serial numbers. This apply to all modules.. Am i doing correct?
Exp1:
Update count sheet line 1 , Update counted qty : 3
Serial Line 0: A1
Serial Line 1: A2
Serial Line 2: A3
2nd time update
Update count sheet line 1, Update counted qty : 4
Serial Line 0: A4
Serial Line 1: A5
Serial Line 2: A6
Serial Line 4: A7
'Delete All BatchNumbers
intDelBatchRowCount = oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Count - 1
For intDelBatchRowCount = intDelBatchRowCount To 0 Step -1
oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Remove(intDelBatchRowCount)
Next
'Delete All SerialNumbers
intDelSerialRowCount = oIC.InventoryCountingLines.Item(iRow).InventoryCountingSerialNumbers.Count - 1
For intDelSerialRowCount = intDelSerialRowCount To 0 Step -1
oIC.InventoryCountingLines.Item(iRow).InventoryCountingSerialNumbers.Remove(intDelSerialRowCount)
Next
''Add BatchNumbers
For intBatchRowCount = 0 To dviewBatchNo.Count - 1
oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Add()
oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Item(intBatchRowCount).BatchNumber = dviewBatchNo(intBatchRowCount)("BatchNo")
oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Item(intBatchRowCount).Quantity = dviewBatchNo(intBatchRowCount)("Quantity")
If Not IsDBNull(dviewBatchNo(intBatchRowCount)("PackDate")) Then
oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Item(intBatchRowCount).ManufactureDate = dviewBatchNo(intBatchRowCount)("PackDate")
End If
If Not IsDBNull(dviewBatchNo(intBatchRowCount)("ExpDate")) Then
oIC.InventoryCountingLines.Item(iRow).InventoryCountingBatchNumbers.Item(intBatchRowCount).ExpiryDate = dviewBatchNo(intBatchRowCount)("ExpDate")
End If
Next
''Add SerialNumbers
For intSerialRowCount = 0 To dviewSerialNo.Count - 1
oIC.InventoryCountingLines.Item(iRow).InventoryCountingSerialNumbers.Add()
oIC.InventoryCountingLines.Item(iRow).InventoryCountingSerialNumbers.Item(intSerialRowCount).InternalSerialNumber = dviewSerialNo(intSerialRowCount)("SerialNo")
Next