Question Adding a suffix to the end of a string?

grimtar27

New member
Joined
Nov 22, 2009
Messages
2
Programming Experience
Beginner
Alright so, I've got most of a program I am doing finished, but I'm having a problem at the end. The user enters a SKU (XXX-XX-XXX) and hits search, and it will search two excel sheets and output the quantity of both. The first sheet works perfectly, however the second it can have multiple instances of the SKU, and I need it to locate the one that says "XXX-XX-XXX Total" and output the quantity of that one, but I cannot seem to get adding the "total" suffix right, as it constantly says SKU not found. I've made sure it's parsing it correctly by outputing each parsed field into a msgbox, any ideas?

Thanks.
 
Is it possible there is a case sensitive thing or a missing " " in your search?
and I need it to locate the one that says "XXX-XX-XXX Total" and output the quantity of that one, but I cannot seem to get adding the "total" suffix right
Or post some code for us to help you.
 
Alright, here is what I have for this specific sheet.

Dim SKUSheet2 As New ArrayList
Dim ReturnValueWH As Integer

Using MyReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser(ofdWarehouse.FileName)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
Dim currentRow1 As String()
While Not MyReader.EndOfData
Try
currentRow1 = MyReader.ReadFields()
Dim currentField As String
For Each currentField In currentRow1
SKUSheet2.Add(currentField)
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & _
"is not valid and will be skipped.")
End Try
End While
End Using
ReturnValueWH = SKUSheet2.IndexOf(textSKU.Text & " total")
If ReturnValueWH = -1 Then

textWarehouse.Text = "NOT FOUND"
Else

End If
ReturnValueWH = ReturnValueWH + 1
textWarehouse.Text = SKUSheet2(ReturnValueWH)

Currently that's what I've got, and the textsku.text works for the first sheet, as there is only one instance of each SKU, but since I need to filter through a few, is there any way to do that? The above posters idea sounds promising, I'm supposing loop through the matching ones until it finds total in the element?
 
FYI, the code tags are what you wanted not the quote tags - they keep your code outlining for better readability. Also I'm leaving on vacation tomorrow, hope you get this figured out.
 
Back
Top