Hello I am building a console application in VB.NET that reads a record file and outputs it to the user. I have gotten the program to output all of the records to the console but I cannot seem to get the search function working.
I want the user to input the record number and for the program to search the text file for that specific record and then output it to the console.
I will leave the read record function here for reference.
Read Records function:
Public Function Read_Records()
File_Name = "drecords.txt"
File_num = FreeFile()
Record_Counter = 0
record_no = 999
If File_Name <> "" Then
Try
FileOpen(File_num, File_Name, OpenMode.Input)
Do Until EOF(File_num)
Record_Counter = Record_Counter + 1
record_no = record_no + 1
records(Record_Counter, 0) = record_no
records(Record_Counter, 1) = LineInput(File_num)
records(Record_Counter, 2) = LineInput(File_num)
records(Record_Counter, 3) = LineInput(File_num)
records(Record_Counter, 4) = LineInput(File_num)
records(Record_Counter, 5) = LineInput(File_num)
Loop
record_ID = Record_Counter
Catch ex As Exception
MsgBox("ERROR OPENING FILE")
Finally
FileClose(File_num)
End Try
End If
Last_Record = Record_Counter
Return records
End Function