VB.NET: I Cant find the index of an array
- by steve
This is the code for my array (which is working)
Public numUsers As Integer
Public fNameUsers As String = ("..\..\..\users.txt")
Public UserRecords As Usersclass() 'note... this line is in a module '
reader = New System.IO.StreamReader(fNameUsers)
numUsers = 0
'Split the array up at each delimiter of "," and add new objects '
Do While reader.Peek <> -1
ReDim Preserve UserRecords(numUsers)
oneline = reader.ReadLine
fields = oneline.Split(",")
UserRecords(numUsers) = New Usersclass
UserRecords(numUsers).AccountNumber = fields(0)
UserRecords(numUsers).CourseName = fields(1)
UserRecords(numUsers).FirstName = fields(2)
UserRecords(numUsers).LastName = fields(3)
UserRecords(numUsers).DOB = fields(4)
UserRecords(numUsers).Email = fields(5)
UserRecords(numUsers).CourseProgress = (6)
UserRecords(numUsers).AdminCheck = fields(7)
numUsers = numUsers + 1
Loop
reader.Close()
My problem is that I don't know how to lookup the index of an array where the .accountNumber = a variable. For example the acccountNumber is 253, what is the code to find the index this relates to????
Thanks in advance