using a file dialog box, then output selected file to listbox

im using a file dialog box to let the user see a list of text files (*.txt) when i select one to open.it wont output it in my listbox im using a do while loop to read each item from the file and print it in upper case in a listbox.
bob sagetAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Obadiah ChristopherCommented:
A sample code might help identifying the issue.

Is this a windows desktop application?
0
bob sagetAuthor Commented:
Dim file() As String

        ofdquest1.Filter = "Text.Files|*.txt"

        ofdquest1.FileName = ""

        ofdquest1.ShowDialog()
        Do While ofdquest1.FileName <> ""
            file = IO.File.ReadAllLines(ofdquest1.FileName)
        For i = 0 To file.Count - 1
                lstrelease.Items.Add(file(i))
                If ofdquest1.FileName <> "" Then
                    file = IO.File.ReadAllLines(ofdquest1.FileName)



                Else
                    MessageBox.Show("select a file forst")
                End If

            Next
        Loop

        file.close()




and yes it is.
0
Obadiah ChristopherCommented:
Have you tried to print this value in say a textbox?

file = IO.File.ReadAllLines(ofdquest1.FileName)

I am guessing it isn't able to read the filepath.

If you are indeed getting the value in the file variable, try to omit these lines and see what happens.

 If ofdquest1.FileName <> "" Then
                    file = IO.File.ReadAllLines(ofdquest1.FileName)
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NorieAnalyst Assistant Commented:
Bob

Are you trying to read text from one file or multiple files into the listbox?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.