How to Replace an Arraylist
- 1). Create the ArrayList variable. A variable needs initializing before you can use an ArrayList in your code. The following code shows you how to create the variable:
Dim arrList as New ArrayList() - 2). Add some values to the ArrayList. ArrayLists can contain hundreds and even thousands of values. In this example, two values are assigned to the list:
arrList.Add("one")
arrList.Add("two") - 3). Replace the ArrayList by copying its content to a one-dimensional array. The following code creates a one-dimensional array and copies the ArrayList to the variable:
Dim oneDimArray() as String
arrList.CopyTo(oneDimArray)