Return Structure Name from Array

korkydn

New member
Joined
Jan 28, 2005
Messages
1
Programming Experience
3-5
If I create a Structure and assign an array to it, is there any way to search for the value in an array and return the structure name? I am sure that the name is associated with the array index but I don't know what property it has.
As a simple example...

Public Structure MyStructure
dim A as String
dim B as string
dim C as string
End Structure

Public myArray(0) As MyStructure

myArray(0).A = "Bill"
myArray(0).B = "Tom"
myArray(0).C = "Joe"

Is there a way to loop through the array to find the value "Bill" and return
whether it is contained in A, B or C?
I am actually trying to populate an array with values from fields on a form.
The field names are the same as the Structure names. So I could set the values
by comparing the names.

Thanks
 
VB.NET:
dim intArrayindex as Integer
intArrayindex = myArray.Binarysearch(myArray, "Tom")
txtMyTextBox.text = myArray(intArrayindex)

is that kind of what you're looking for? a binary search only returns the index of what your looking for it returns a -4 if nothing is found
 
Back
Top