Error converting string to arraylist

  • Thread starter Thread starter Bobby Edward
  • Start date Start date
B

Bobby Edward

Here's my code...

Dim alKeywords As ArrayList, bKeywordFound As Boolean = False

alKeywords = CType(dr("SearchValue"), ArrayList)



dr("SearchValue") is equal to "ca xyx ha". I wanted it to convert to an
arraylist with 3 items. But I keep getting this....
Unable to cast object of type 'System.String' to type
'System.Collections.ArrayList'.

Any idea why?
 
Bobby said:
Dim alKeywords As ArrayList, bKeywordFound As Boolean = False
alKeywords = CType(dr("SearchValue"), ArrayList)

dr("SearchValue") is equal to "ca xyx ha". I wanted it to convert to
an arraylist with 3 items. But I keep getting this....
Unable to cast object of type 'System.String' to type
'System.Collections.ArrayList'.

Any idea why?

Do you maybe want to dr("SearchValue").Split(" "c) at some point?

Andrew
 
Back
Top