using System; using System.Windows.Forms; namespace WindowsFormsApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Button1_Click(object sender, EventArgs e) { // Displays a FolderBrowserDialog and sets the selected folder. using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) { DialogResult result = folderBrowserDialog.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath)) { // Do something with the selected folder path... } } } } }In this example, a button click event opens a FolderBrowserDialog using the using statement. The if statement checks if the user selected a folder and then performs some action with the selected folder path. The using statement is used to automatically dispose of the FolderBrowserDialog once it is no longer needed. The System.Windows.Forms FolderBrowserDialog belongs to the System.Windows.Forms namespace in the .NET Framework library.