dotnetnoob said:
i have a arraylist that look like this
item 0 - hold this value 1,2,4
item 1 - hold this value 3,6,7
if i want to access the item 0 i get the whole 1,2,4 how do i seperate them
out like i want "1" how do i access item 0 but the first value "1".
thank
You could do this several ways. One option is to create a structure and
use that for your items:
--------------------------------
Public Structure DataItem
Dim value1 as Integer
Dim value2 as Integer
Dim value3 as Integer
End Structure
--------------------------------
For each item that you have, you could create a new DataItem and assign
the values appropriately. Using the values from your example above:
--------------------------------
Dim newItem as new DataItem
newItem.value1 = 1
newItem.value2 = 2
newItem.value3 = 4
--------------------------------
After you've created DataItems for all of the data, you could put them
into an array of type DataItem like so:
--------------------------------------------------
Dim DataItems as DataItem() = {var1,var2,var3,...}
--------------------------------------------------
or add them to an ArrayList. If you use an arraylist, you'll most
likely have to cast the object to type DataItem to access the
..value1,.value2,.value3 items.
A structure is a simple form, you could always create a class to hold
the data, and instantiate the values in a constructor.
Hope this Helps