VB.NET "Can't convert string array into integer"?

Michael K

New member
Hi,

I'm pretty much a beginner with VB.NET and am in the middle of a project for my class. I created an array of strings that pulls data from a csv file, and now im trying to update a database file with it. It gives me an error, though, saying it can't convert my string array into an integer. Can anyone help me?

Dim UPCquantity As Integer
Dim updatedUPCquan As Integer
Dim UPC As Integer
Dim UPCquan As Integer
Dim upcstring(0) As String
Dim inputstream As New FileStream("packingslip.csv", FileMode.Open, FileAccess.Read)
Dim reader As New StreamReader(inputstream)


Do Until reader.EndOfStream
upcstring = reader.ReadLine.Split(",")

UPC = upcstring(0)
UPCquan = upcstring(1)
UPCquantity = myInvDB.GetQtyOnHand(1, UPC)
updatedUPCquan = UPCquan + UPCquantity
myInvDB.UpdateQtyOnHand(1, UPC, updatedUPCquan)
Loop
If myInvDB.UpdateQtyOnHand(1, manualUPC.Text, updatedUPCquan) = True Then
MsgBox("Successful Entry")
Else
MsgBox("Unsuccessful")
End If
End Sub
the array of strings is all numbers. I understand that you can't add strings. I just don't know how to convert the array to integers
 
Back
Top