Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9199071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:26:33+00:00 2026-06-17T22:26:33+00:00

Hello I am building a console application in VB.NET that reads a record file

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:26:34+00:00Added an answer on June 17, 2026 at 10:26 pm

    I’m not sure exactly what you want, but here are a few examples.

    To read a record number from the console and output that record, do something like this:

    dim i, k as integer
    k = val(console.readline())
    for i = 1 to 5
      console.writeline(records(k, i))
    next i
    

    I’m not sure how else you would identify the record, but, for example, you can search the records for a value of “abc” in the first field like this:

    For i = 1 to Last_Record
      if records(i, 1) = "abc" then
        ' output the record to the user
      end if  
    next i
    

    Replace records(i, 1) with records(i, 0) to search for a record number.

    If you want to search each field, you can add a nested loop:

    For i = 1 to Last_Record
      for k = 1 to 5
        if records(i, k) = "abc" then
          ' output the record to the user
        end if  
      next k
    next i
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm building a Spring MVC web application that runs on Tomcat 6.0.20 and
I'm building an ASP.NET MVC3 website. I have some javascript in my .cshtml file:
Hello I am building a news application in android, so that every time a
Hello I'm building an application with Yii that will now generate reports. My client
Helo. I am building an application for kids using Phonegap. On Android I have
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
Hello i'm doing a application in php, and i have a list of items
I have a MVC Sencha Touch application I'm building and am having some issues
I've made a hello world module for orchard following this tutorial http://docs.orchardproject.net/Documentation/Building-a-hello-world-module I've opened
Hello I'm building spring-hibernate application. Do i realy need configuration from below ? <property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.