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()
我的問題是,我不知道如何查找數組的索引,其中.accountNumber =一個變量。例如,acccountNumber是253,找到與此相關的索引的代碼是什麼?VB.NET:我不能找到一個數組的索引
在此先感謝
我編輯了標題。不要讓人們認爲你是那種認爲.net在他的代碼不起作用時必須被破解的人。 ; -O歡迎使用StackOverflow,並確保在他們滿意時接受並提供答案。 – 2010-04-15 11:03:03