Link to home
Start Free TrialLog in
Avatar of AEII
AEII

asked on

Code Snip C#

I am sure somewhere there is the following code I would like to get:

File Path Box with Browse Button that opens the Windows file browser and when the file is selected
it puts it in the Path Field..  
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Hi AEII,

1. placed a folderbrowsedialog, a button and a textbox on a form
2. and used this code in the button click eventhandler

--------
            folderBrowserDialog1.ShowDialog();
            if(folderBrowserDialog1.SelectedPath!="")
            textBox1.Text  =  folderBrowserDialog1.SelectedPath;
--------

3. it will show the selected path in the textbox1 if one is selected

hope this helps a bit
bruintje
SOLUTION
Avatar of Fahad Mukhtar
Fahad Mukhtar
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you can place the dialog on your form too, in 2005 at least
its a choice depending on your application, so no correction but an addition i tested before posting :)
yes...
FolderBrowserDialog wasnt included in VS.Net 2002 (.net 1.0 FCL) (the code wont work for .net 1.0)
FolderBrowserDialog was included in VS.Net 2003 (.net 1.1 FCL) but wasnt included in the toolbox..(the code will work for .net 1.1)
 Finally in vs 2005 (.net 2.0) the control included in the toolbox (the code will work for .net 2.0)
:) you are correct i should've mentioned that in the comment
Avatar of AEII
AEII

ASKER

Well we are getting close, but one more thing ...

The FolderBrowser only get to Folder Level ... I need to select
a specific .exe (file level)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial