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

  • Home
  • SEARCH
  • 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 5999423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:32:59+00:00 2026-05-23T00:32:59+00:00

So in my program i am trying to make it so that when you

  • 0

So in my program i am trying to make it so that when you press a button it opens a “choose file” popup(where the user can choose a text file) then after the user chooses it the program will automatically load each line of the textfile into a listbox.

But i have been researching it and the only thing i have been able to find is a file>open thing. So how cold i make it open a “open” dialogue on the press of a button

and since i haven’t been able to find anything on the open dialogue i haven’t looked for anything on the loading each line of it into a listbox, so if anyone wants ot help me with that it would be great.

and i do not have any code to show you as the rest of my program has no relevance to this

  • 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-23T00:32:59+00:00Added an answer on May 23, 2026 at 12:32 am
        Using FD As New OpenFileDialog()
            FD.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
            If FD.ShowDialog = Windows.Forms.DialogResult.OK Then
                Listbox1.Items.Clear
                ListBox1.Items.AddRange(IO.File.ReadAllLines(FD.FileName))
            End If
        End Using
    

    EDIT: Answer on the comment:

    If you can use LINQ, then its a one row of code to read all lines from the listbox and write it to a file:

    Save using SaveFileDialog and LINQ

        Using FD As New SaveFileDialog()
            FD.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
            If FD.ShowDialog = Windows.Forms.DialogResult.OK Then
                IO.File.WriteAllLines(fd.filename, (From p As String In ListBox1.Items Select p).ToArray)
            End If
        End Using
    

    If you can’t use LINQ, then you can do this instead:

    Save using SaveFileDialog and FOR/EACH

         Using FD As New SaveFileDialog()
            FD.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
            If FD.ShowDialog = Windows.Forms.DialogResult.OK Then
                Dim FileContent As String = ""
                For Each i As String In ListBox1.Items
                    FileContent &= i & vbCrLf
                Next
                IO.File.WriteAllText(FD.FileName, FileContent)
            End If
        End Using 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a Python program that retrieves only the body text of
I'm trying to make a program that read a file line by line and
I am trying to make a program that after it generates a public/private key
I am trying to make a program that dynamically creates a button using the
So I'm trying to make my program output a text file with a list
So i'm trying to make a program that can find how many pixels of
I'm trying to make a program in Visual C# that has my one created
I'm trying to fill-out a form automatically and press a button on that form
I'm trying to make a program that check the ISBN number and sees if
i'm trying to make a program that inserts data into specific places in existing

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.