Create a Folder Browser in C#

  • Thread starter Thread starter Anon
  • Start date Start date
A

Anon

Hi,

How can I create a *folder* browser (not file browser)? This means if
the user selects a folder and then selects "OK", the dialog closes and
returns the folder name.

Now I have the code in C# that allows the user to select a file name.
However, I'll only need to select a folder. What changes do I have to
make?

private void Browse_Click(object sender,
System.EventArgs e)
{
axCommonDialog.FileName = txtInput.Text;
axCommonDialog.ShowOpen();
txtInput.Text = axCommonDialog.FileName;

}

The definition of axCommonDialog is
private AxMSComDlg.AxCommonDialog axCommonDialog;

Many thanks!
 
You are not still using .NET 1.0, are you? Since .NET 1.1, there is
FolderBrowser control available in Windows.Forms namespace.
 
Back
Top