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 616103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:17:27+00:00 2026-05-13T18:17:27+00:00

this is probably not that hard to do. But I’ve got two text files.

  • 0

this is probably not that hard to do.
But I’ve got two text files. The first has got a list of certain keywords.
Each one if these keywords are fed into a combobox.

Now, when I choose one of the items from this combobox, I want to search the other textfile for the same keyword and read from that point to the next keyword. And then feed each line into a listbox. Hope I make myself understood.

Perhaps I should use an INI-file for this purpose, doesn’t really matter for me.

The textfiles have this structure;
Textfile1:

London
Oslo
New York
Hamburg
Amsterdam

The second textfile has this structure;
Textfile2:

'London'
Apples
Oranges
Pears

'Oslo'
Pasta
Salami
Monkeyballs

'New York'
Dada
Duda
Dadadish

Etc etc.

Is this possible? The reason I want to do it this way is to create a fully dynamic system. One which relies fully on whatever information is stored in these textfiles. I’m gonna build pretty complex strings from these results later on.

So far, I’ve got this to read the first file and add each line to the combobox:

Dim oReadMenuFunction as System.IO.StreamReader
oReadMenuFunction = IO.File.OpenText("textfile1.txt")

Do While oReadMenuFunction.Peek <> -1
    Dim LineIn as String = oReadMenuFunction.ReadLine()
    Combobox.Items.Add(LineIn)
Loop
  • 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-05-13T18:17:27+00:00Added an answer on May 13, 2026 at 6:17 pm

    Here’s a sample function you could use to parse your second file. It takes a keyword as argument and returns the associated items:

    Function ReadData(ByRef keyword As String) As IEnumerable(Of String)
        Dim result = New List(Of String)
        Using reader = New StreamReader("file2.txt")
            Dim line As String = reader.ReadLine()
            Dim take = False
            Do While line IsNot Nothing
                If line.StartsWith("'") Then
                    take = False
                End If
                If String.Equals("'" + keyword + "'", line) Then
                    take = True
                End If
                If take And Not String.IsNullOrEmpty(line) And Not line.StartsWith("'") Then
                    result.Add(line)
                End If
                line = reader.ReadLine()
            Loop
        End Using
        Return result
    End Function
    

    And you use it like this:

    Dim items = ReadData("London")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.