473,385 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Display OpenFileDialog box & get the list of files selected back

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

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

End Sub
End Class

Mar 30 '06 #1
0 1113

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bonzo | last post by:
Hi, How do I simply open a text file into a textbox? I know that in C++ I'd use something like: if(OpenDialog1->Execute()) Memo1->Lines->LoadFromFile(OpenDialog1->FileName); How can I do it...
4
by: Nagachandra Sekhar Grandhi | last post by:
I am facing a problem with OpenFileDialog. It is as follows. I opened OpenFileDialog dialog box and selected a folder in it. After selecting the folder when i tried to delete the same folder in...
4
by: Chuck Edgeworth | last post by:
I'm trying to be able to select a combination of files and folders. When I try to use the OpenFileDialog it will allow me to select them but when I press the Open button it only informs me of the...
8
by: marcus.kwok | last post by:
I am having a weird problem and I have can't figure out why it is happening. I create an OpenFileDialog and set a filename filter. When the dialog first opens, the filter works correctly, and...
0
by: Gregaz | last post by:
I have a form in my project, which I open as a DialogBox. On that that form there are 3 TextBoxes. To one of them I want to write in a file path. To have it easier I have an OpenFileDialog control...
4
by: helloitsme | last post by:
Hello! I am trying to open a file that is selected by a user from the openfiledialog box, but the file does not open. Below is the part of the code that does so... ...
2
by: MikeY | last post by:
Hi everyone, I"m having a problem with the OpenFileDialog() changing my path to save to my .resources file. I'm a bit baffled why this is happening, even when I set the OpenFileDialog back to...
0
by: mbewers1 | last post by:
Hi I'm having a problem trying to get a customised OpenFileDialog() to fulfil my requirements. The code for this custom-built dialog has been taken from another site...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.