10

I have an array of String and I have to convert it to an ArrayList. Is it possible to do it in VB.Net?

1
  • This is a VB.Net question, not a VB6 question. There's no way you could do this in VB6 Dim AList as ArrayList = New ArrayList(StrArry) VB6 only supports parameterless constructors. I am editing your question, tags, etc Commented Feb 27, 2012 at 12:30

1 Answer 1

15

Try this

Dim sArray() as String 'array of strings
...
Dim aList as ArrayList = New ArrayList(sArray)
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks but it does not work since ArrayObject has to implement IList and the way array implements IList is a bit awkward
thanks but that one is Java...and VB6 does not have ToList() method for arrays
can't we do like this Dim AList as ArrayList = New ArrayList(StrArry); // StrArry will be our array of strings?
yes it works, update your answer and you get the points ;-) Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.