Simple "Browse for a file" control

G

Guest

I apologize that I am new to windows forms programming. I'm looking for the
correct control or components to use to create standard browse-for-a-file
capability. I'd like to have a textbox and a button next to it that says
"Browse". When you click the browse button you would get the standard
windows api dialog that allows you to browse for a particular file. When the
user finds his/her file, they would select it and the textbox would be
populated with their selection.

This is very easy to do with web / html controls, but I've never had to do
it in a windows form unfortunately. I've done a bit of googling and I'm
getting results for a lot of custom / enhanced solutions. I'm looking for a
simple example. If anyone could please provide some direction I'd greatly
appreciate it.
 
M

Morten Wennevik

Hi

In your Button event create an OpenFileDialog and use its ShowDialog method. There is also the SaveFileDialog.
 
C

Cerebrus

Also, all these "common dialogs" are there in the .NET Toolbox. You can
directly add them to your form from there, as well.

Regards,

Cerebrus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top