473,670 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginner help with FolderBrowserDi alog

I'm learning VB and am making an application where I need a user to be
able to choose which folder his files are located in. The folder path
chosen will be stored as a string for later use in the application. I
tried adding FolderBrowserDi alog to my form but can't figure out how to
get it to work. I'm just above the 'Hello World' level here. Thanks.

Dec 27 '06 #1
6 1979
<ch********@gma il.comschrieb:
I'm learning VB and am making an application where I need a user to be
able to choose which folder his files are located in. The folder path
chosen will be stored as a string for later use in the application. I
tried adding FolderBrowserDi alog to my form but can't figure out how to
get it to work. I'm just above the 'Hello World' level here.
Place a FolderBrowserDi alog component on your form and add the code below to
a button's 'Click' event handler:

\\\
If _
Me.FolderBrowse rDialog.ShowDia log() = _
System.Windows. Forms.DialogRes ult.OK _
Then
MsgBox(Me.Folde rBrowserDialog. SelectedPath)
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 27 '06 #2
Place a FolderBrowserDi alog component on your form and add the code below to
a button's 'Click' event handler:

\\\
If _
Me.FolderBrowse rDialog.ShowDia log() = _
System.Windows. Forms.DialogRes ult.OK _
Then
MsgBox(Me.Folde rBrowserDialog. SelectedPath)
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Very fast and excellent reply! Thank you very much. You made it much
easier than all the solutions I was finding on websites. It is working
beautifully now!

I added your code and replaced the MsgBox with -

strTestPath = (Me.FolderBrows erDialog1.Selec tedPath)
txtTestPath.Tex t = (Me.FolderBrows erDialog1.Selec tedPath)
Thanks again!

Chris

Dec 27 '06 #3
Chris,

Don't mean to make Herfried blush, but he's got a lot of good answers. My
abilities at coding are probably about the same as yours and he and the
others have helped me to learn a lot of stuff in a very short period of
time. One of the things that they have been able to show me is how to
condense my code to make it more efficient and, if you don't mind me adding
my two cents..
strTestPath = (Me.FolderBrows erDialog1.Selec tedPath)
txtTestPath.Tex t = (Me.FolderBrows erDialog1.Selec tedPath)
If you are using a control to store a value on your form, that value can be
called from anywhere in the code for that form at any time, so your two
lines of code can actually be condensed down to one line...

txtTestPath.Tex t = Me.FolderBrowse rDialog1.Select edPath

I found out that I really didn't need the parentheses either, thanks to...
blush... these fine folks.

HTH,

Bruce

Dec 28 '06 #4
Be aware that if you don't install the servicepack in version Net 1.1 you
can get very serious errors.

:-)

Cor

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atschre ef in bericht
news:%2******** *******@TK2MSFT NGP06.phx.gbl.. .
<ch********@gma il.comschrieb:
>I'm learning VB and am making an application where I need a user to be
able to choose which folder his files are located in. The folder path
chosen will be stored as a string for later use in the application. I
tried adding FolderBrowserDi alog to my form but can't figure out how to
get it to work. I'm just above the 'Hello World' level here.

Place a FolderBrowserDi alog component on your form and add the code below
to a button's 'Click' event handler:

\\\
If _
Me.FolderBrowse rDialog.ShowDia log() = _
System.Windows. Forms.DialogRes ult.OK _
Then
MsgBox(Me.Folde rBrowserDialog. SelectedPath)
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 28 '06 #5

Bruce W. Darby wrote:
Chris,

Don't mean to make Herfried blush, but he's got a lot of good answers. My
abilities at coding are probably about the same as yours and he and the
others have helped me to learn a lot of stuff in a very short period of
time. One of the things that they have been able to show me is how to
condense my code to make it more efficient and, if you don't mind me adding
my two cents..
strTestPath = (Me.FolderBrows erDialog1.Selec tedPath)
txtTestPath.Tex t = (Me.FolderBrows erDialog1.Selec tedPath)

If you are using a control to store a value on your form, that value can be
called from anywhere in the code for that form at any time, so your two
lines of code can actually be condensed down to one line...

txtTestPath.Tex t = Me.FolderBrowse rDialog1.Select edPath

I found out that I really didn't need the parentheses either, thanks to...
blush... these fine folks.

HTH,

Bruce

Thank you Bruce. I've changed it in my code!

Chris

Dec 28 '06 #6
<ch********@gma il.comschrieb:
I added your code and replaced the MsgBox with -

strTestPath = (Me.FolderBrows erDialog1.Selec tedPath)
txtTestPath.Tex t = (Me.FolderBrows erDialog1.Selec tedPath)
Just remove the brackets on the right side, they do not make sense here.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 28 '06 #7

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

Similar topics

25
2219
by: | last post by:
Hi, The following code shows the FolderBrowserDialog = broken. FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.ShowNewFolderButton = false; folderDialog.ShowDialog(); Setting ShowNewFolderButton to false does bugger all. If I set this to false it is STILL shown. Genius.
0
1051
by: Alpha | last post by:
My FolderBrowserDialog shows just the description on the top then 3 buttons (OK, Cancel, NewFolder) at the buttom of the dialog. It doesn't desplay the directory tree. I even specified not to show the NewFolder button and it still has it there. How can I fix this problem? Thanks, Alpha private void btnDirBrowser_Click(object sender, System.EventArgs e) {
6
1784
by: John Krueger | last post by:
The FolderBrowserDialog control in my toolbox has vanished! I did not delibratly remove it and it is just not there anymore. I tried to add it back to the toolbox but there isn't even a .NET component (or even a COM) available to select from in the "Customize Toolbox" window! I noticed there is a RESET button on the "Customize Toolbox" window but I have a number of custom controls it said it would delete. I was hesitant about that...
5
7342
by: Scott M. Lyon | last post by:
My application (a VB.NET 2003 WinApp) currently has first an OpenFileDialog (asking for an input file to the process I'm working on), and then once the user selects that, it brings up a FolderBrowserDialog box (asking for a destination for the output files from the process to be saved). The OpenFileDialog works beautifully. The problem is, after the user selects the input file from the
4
1876
by: hotmit | last post by:
I'm trying to create a program that dynamicly saves and loads path of a FolderBrowserDialog , but I ran into a problem. Since FolderBrowserDialog is not a Control, therefore it doesn't have attribute such as Name. How do I get the name of a Component or unique string to identify each FolderBrowserDialog instances in the my form. I tried GetHashCode() but that doesn't work out too well. Any suggestion is apreaciated!!! Thanks
2
3156
by: Marcel Brekelmans | last post by:
Hi, I'm trying to display a MessageBox after a FolderBrowserDialog. I see that it gets displayed, but not activated. The form is not in front and when I have some other forms open the MessageBox is hidden behind them. The problem seems to occur only after using the FolderBrowserDialog. Has anyone seen this before? Thanks
7
2229
by: Paul W | last post by:
Hi everybody, This may seem like a Shell question, but I believe it belongs here. I'm trying to make a wrapper class for the SHBrowseForFolder function. This function provides for a callback to your code for certain situations. I've done this in c# but can't seem to get it to work here. This is the delegate: public __delegate int BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM
4
3217
by: Jerry West | last post by:
I'm trying to set the .RootFolder property of the FolderBrowserDialog object. Each time I try I get an error stating: "Object reference not set to an instance of an object." I have not opened the VB toolbox and placed a FolderBrowserDialog onto a Form. Instead, I have simply declared a var as FolderBrowserDialog within a module and attempted to use it. Is this the reason why I receive this error? My goal was to simply create a...
0
8468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8901
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8660
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7415
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2041
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.