定义一个窗体继承自System.Windows.Forms.Form。
添加以下控件对象到窗体:
Private folderBrowserDialog1 As System.Windows.Forms.FolderBrowserDialog
Private button1 As System.Windows.Forms.Button
Private listBox1 As System.Windows.Forms.ListBox
给button1的Click事件添加以下处理程序:
Sub Button1Click(sender As Object, e As EventArgs)
If System.Windows.Forms.DialogResult.OK=Me.folderBrowserDialog1.ShowDialog(Me) Then
Me.listBox1.Items.AddRange(System.IO.Directory.GetFiles(Me.folderBrowserDialog1.SelectedPath))
End If
End Sub