7
A
回答
6
將它添加到一個DropDownList:
Private Sub TestCase1()
Dim drive As System.IO.DriveInfo
For Each drive In System.IO.DriveInfo.GetDrives()
If drive.DriveType = IO.DriveType.Network Then
DropDownList1.Items.Add(drive.Name)
End If
Next
End Sub
這是我會怎麼做它在C#:
private void TestCase1()
{
//Recurse through the drives on this system and add them to the new DropDownList DropDownList1 if they are a network drive.
foreach(System.IO.DriveInfo drive in System.IO.DriveInfo.GetDrives())
{
//This check ensures that drive is a network drive.
if (drive.DriveType == System.IO.DriveType.Network)
{
//If the drive is a network drive we add it here to a combobox.
DropDownList1.Items.Add(drive);
}
}
}
1
麥克有一個很好的答案,我會添加一些東西,以防止它每次點擊打開時增長。很好說.... VB中的組合框。
Dim drive As System.IO.DriveInfo
If DropDownList1.Count < 1
For Each drive In System.IO.DriveInfo.GetDrives()
If drive.DriveType = IO.DriveType.Network Then
DropDownList1.Items.Add(drive.Name)
End If
Next
End If
相關問題
- 1. 映射網絡驅動器
- 2. 映射網絡驅動器
- 3. 映射網絡驅動器
- 4. 映射網絡驅動器與陣列
- 5. 映射網絡驅動器上的FileSystemWatcher
- 6. 查詢映射網絡驅動器
- 7. Powershell /批量網絡映射驅動器
- 8. 如何在C#中獲得網絡映射驅動器VolumeLabel?
- 9. 如何獲得映射的網絡驅動器的盤符
- 10. 被映射網絡使用Visual Studio 2012</p> <p>我需要映射/取消映射網絡驅動器,以及獲得所有當前映射的驅動器列表中的Windows 8
- 11. 如何獲得可用的網絡驅動器映射?
- 12. 映射從csv讀取的網絡驅動器VBS
- 13. Powershell:映射/取消映射遠程計算機上的網絡驅動器
- 14. Powershell腳本映射到網絡驅動器和下載文件
- 15. 如何以靜默方式取消映射映射網絡驅動器
- 16. 映射網絡驅動器檢查.txt文件中的用戶列表
- 17. 使用Delphi映射網絡驅動器沒有WNetAddConnection2
- 18. 我如何通知IIS有一個網絡映射驅動器
- 19. 無法獲取映射驅動器的關聯網絡UNC C/C++
- 20. 從網絡服務器複製目錄到映射的網絡驅動器
- 21. 通過網頁映射網絡驅動器
- 22. 如何在Python中刷新網絡驅動器映射
- 23. 在Windows 7中映射網絡驅動器
- 24. 在Visual Basic 2010中映射網絡驅動器
- 25. 映射的SharePoint 2013的網絡驅動器到Mac
- 26. DirectoryInfo.Exists找不到我映射的網絡驅動器C#
- 27. ASP.NET - 將文件複製到映射的網絡驅動器
- 28. 無法訪問映射的網絡驅動器
- 29. 團隊建立不能訪問映射的網絡驅動器
- 30. 防止訪問映射的網絡驅動器