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 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

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?
bob sagetAuthor Commented:
Dim file() As String

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

        ofdquest1.FileName = ""

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

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



and yes it is.
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)

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:

Are you trying to read text from one file or multiple files into the listbox?
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.