bob saget
asked on
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.
ASKER
Dim file() As String
ofdquest1.Filter = "Text.Files|*.txt"
ofdquest1.FileName = ""
ofdquest1.ShowDialog()
Do While ofdquest1.FileName <> ""
file = IO.File.ReadAllLines(ofdqu est1.FileN ame)
For i = 0 To file.Count - 1
lstrelease.Items.Add(file( i))
If ofdquest1.FileName <> "" Then
file = IO.File.ReadAllLines(ofdqu est1.FileN ame)
Else
MessageBox.Show("select a file forst")
End If
Next
Loop
file.close()
and yes it is.
ofdquest1.Filter = "Text.Files|*.txt"
ofdquest1.FileName = ""
ofdquest1.ShowDialog()
Do While ofdquest1.FileName <> ""
file = IO.File.ReadAllLines(ofdqu
For i = 0 To file.Count - 1
lstrelease.Items.Add(file(
If ofdquest1.FileName <> "" Then
file = IO.File.ReadAllLines(ofdqu
Else
MessageBox.Show("select a file forst")
End If
Next
Loop
file.close()
and yes it is.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bob
Are you trying to read text from one file or multiple files into the listbox?
Are you trying to read text from one file or multiple files into the listbox?
Is this a windows desktop application?