By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,476 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,476 IT Pros & Developers. It's quick & easy.

Display OpenFileDialog box & get the list of files selected back

P: n/a
Forgive me because this is going to be such a simple question but I'm new and
at the foot of the learning curve of VB. I am trying to develop a Windows
application that will present the user with a fileopendialog box and then get
the list of selected files from the box so I can open them and parse the
contents. The code below opens a file that's been hard coded into the code
and displays it to a text box on my form. How can I change that code to
present the user with an openfiledialog box, allow him to select the files to
be opened and then determine which files were selected and open them so that
I can massage the text in them. Thanks in advance for the help.
Public Class Form1
Private sReader As IO.StreamReader
Private strData As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim openFileDialog1 As New OpenFileDialog()
Dim FileToOpen As String

sReader = IO.File.OpenText("c:\boot.ini")
strData = sReader.ReadToEnd()
TextBox1.Text = strData
Catch ex As Exception
MsgBox("Unable to read file")
If Not (sReader Is Nothing) Then
sReader = Nothing
End If
End Try

End Sub
End Class

Mar 30 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.