I am very new to vb and have been stepping my foot into the waters. I read a lot of posts on this site and it has helped me tremendously. Thanks all!
I have been searching to no end trying to figure out how to write the rest of this code. Basically, I have a directory with a lot of member text files in which stores data about each member. Each line of each member text file is the same criteria: Line1: FirstName, Line2: LastName, Line3: ExpDate, Line4: Status. I need a way to pull Line2 into Listbox1 and Line4 into Listbox2 from each text file. I have tried the following code and it partially seems to work but doesn't complete itself and gives an error.
Error: "Index was out of range. Must be a non-negative and less than the size of the collection. Parameter name: index"
Dim DirActiveMembers() As String = Directory.GetFiles("C:\SPCMembership\Active\")
For Each Member In DirActiveMembers
Dim Line2 As Integer = 2 'Last Name
Dim Line4 As Integer = 4 'Status
Dim LastName As String = (File.ReadAllLines(Member).ElementAt(Line2).ToString)
Dim Status As String = (File.ReadAllLines(Member).ElementAt(Line4).ToString)
ListBox1.Items.Add(LastName)
ListBox2.Items.Add(Status)
Next
Help! please and thank you for your time! :)