FolderBrowser with textbox in VB.NET

I have a textBox which gets filled with a path, acquired from a database (but that's irrelevant). So I want to have a FolderBrowserDialog button where I open -> navigate through the folders and select a path (i.e. by selecting a certain folder) and then OK/Save-ing this path and it to be updated in the textBox.

So in the whole case - I don't know how to use the OpenFolderBrowserDialog, because when I drag it - it only goes in the bottom of the page, but I want to place it as a button on a certain place in my WinForm. And also - how is the selected path saved into a (i.e. string) variable so I can set it as the value of the textbox? A certain method?

Answers


Try like below it will help you..

Place a Text box, Button and FolderBrowserDialog in your Form like below...

Then Double click the button and create Button click Event on your code like below..

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then
        TextBox1.Text = FolderBrowserDialog1.SelectedPath
    End If
End Sub

Then run it.. Now you can open the Folder Browser dialog by clicking the Browse Button..

After selecting the folder Path the path will assigned to Text Box

You can also refer this Article for full reference : FolderBrowserDialog


Need Your Help

Is there a hash algorithm that produces a hash size of 64 bits in C#?

c# hash ssis

I need to produce a Hash value based off of a variable length string that I can store within a field no longer than 16 (due to vendor requirements).

Determine if a JavaScript file is already included via a user control

c# asp.net javascript include telligent

I'm building several user controls (ASCX) for my website and several of them are very similar in what they do. (As a side note, I must create unique UC's even if they're similar because I'm creating

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.