help with simple array construction

oompa_l

Member
Joined
Oct 27, 2009
Messages
7
Programming Experience
Beginner
I need to construct a data array and I am not sure if I can do what I need to do given the data. I probably should opt to store in a new class but that's too advanced for now

the data describes a series of points. each point has its index in a list a boolean, binary value and a list of integers of its neighbour points. so i thought it would be three columns and the third column would store a list. can you do this?

I presume i could get rid of the column dedicated to storing the integers..
 
so you want a index going to X that has 3 values in each index? like
Index(0) = "true,0,5"
Index(1) = "False,1,7"
Index(2) = "False,1,10"
and have each index put into a list view for example?
im not too sure what you exactly what...
 
one column or entry would be a single integer, like 0, 1, 2, 3, 4... - i need this as an index of each one's position in the list

the second would be 0 or 1, or true or false

the third would itself be a list of integers 0,4,5,2,7,2,5,2...

so all together one entry would be {0; 0; 0,4,5,2,7,2,5,2}
while the next might be {1; 0; 6,8,2,5,2,3}

does that make it clearer?
 
so you want 3 different indexes containing a column of data?

and what exactly do you want to do with these indexes? put them into a column?
 
i wish i were better equipped with language to be able to understand and respond properly.

Imagine i have a list of points - think of them as locations of people - and I need to be able to iterate through them and make a new list breaking them into groups. In my list, I need their original index in the original list, a boolean value (0,1 or true/false) and a list of this entry's neighbouring entries (which is given by some other triangualtion function) so it would be composed of a list of integers referring to these others. does that help?

I am not sure about indexes or the dimension of this array in the scenario...
 
Okay.. so you have one array that has say 3 values in each array number. and you want to split the 1 array into multiple arrays?
 
How about making an object to hold your values:
VB.NET:
Public Class myObject
   Public numberIuse As Integer
   Public isSomething As Boolean
   Public otherNumberIuse As Double
End Class

' then load them as you build them

Dim myList As New List(Of myObject)

Dim m As New myObject
m.numberIuse = 1
m.isSomething = True
m.otherNumberIuse = 0.01
myList.Add(m)

:cool:
 
i totally agree that this is a case for fields of an object...I'm just scared to do this in vb - never done it before...I know exactly how I would do it if I were to take what I know of oop in java over to vb...
 
Now is not the time for fear, what else will you need to do with this object - store them? They serialize very well.
 
one more thing

if I had a list of lists of my object - each entry would be a list of these objects...what type of object would I use to contain this

so :
(0) myobject5, myobject4, myobject9
(1) myobject1, myobject7, myobject6
(2) myobject2, myobject8, myobject3
...

ArrayLists, Lists, something else...?
 
what you could do is
dim String() as string = object1 & "," & object2 & "," & object3

you can also put that into a for loop so it does it automatically, then if you want the values in each array to be separate, split the array by "," and
string(0) would be object1
string(1) would be object2
string(2) would be object3

if you wanted to up youre project, i could probably help more.
 
one more thing

if I had a list of lists of my object - each entry would be a list of these objects...what type of object would I use to contain this

so :
(0) myobject5, myobject4, myobject9
(1) myobject1, myobject7, myobject6
(2) myobject2, myobject8, myobject3
...

ArrayLists, Lists, something else...?
List(Of T) where T is the Type of your data. List(T) Class (System.Collections.Generic)
 
@TheDeathly, those aren't strings there objects made from a custom class shown in earlier posts. It seems you want an array of an array - or similarly a List of a List. Or poss a Dictionary holding a key and the List/Array in the Value.
 
Back
Top