Easy - IndexOf

eramgarden

Contributor
Joined
Mar 8, 2004
Messages
579
I'm concating a string together. Then using "indexof" to see if a particular string is in that concated string. I used the link below:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=169&lngWId=10

---This is what i have:
Code:
dim tempCostIDs as string 
tempCostIDs = string.Empty 
... 
tempCostIDs = tempCostIDs & "," & cost.CostTypeID & "," 
... 
Dim Freight As String 
        Freight = ",1," 
        Dim r As Integer 
      [b]  r = tempCostIDs.IndexOf(Freight) [/b]
        If r > 0 Then 
           'do whatever 
        End If
-- I put a debug step. I see "tempCostIDs" has having ",1," in it but that r>0 fails . Howcome it cant find the string in it??
 
Could you post the string literal that tempCostIDs contains when you are executing the .IndexOf? If it really contains the correct string then it should be returning a value > 0
 
Back
Top