嗨,所有编程大师,
目前,通过单击按钮选择路径(文件夹)。
Private Sub SelectButton_Click(sender As Object, e As EventArgs) Handles SelectButton.Click
FolderBrowserDialog1.ShowDialog()
Path.Text = FolderBrowserDialog1.SelectedPath
End Sub
将制作USB驱动器路径的方法有哪些默认FolderBrowserDialog.SelectedPath ?
谢谢!
答案 0 :(得分:1)
请尝试以下代码:
Dim folder = New FolderBrowserDialog()
Dim drives = System.IO.DriveInfo.GetDrives()
Dim usbDrive = drives.FirstOrDefault(Function(m) m.DriveType = System.IO.DriveType.Removable)
folder.SelectedPath = usbDrive.RootDirectory.FullName
If folder.ShowDialog() = DialogResult.OK Then
MessageBox.Show(folder.SelectedPath)
End If