Drive的volumelabel无法存储在数组中 [英] Drive's volumelabel can't store in array
问题描述
我正在尝试将驱动器列表从PC存储到数组中,但我发现它不存储信息。我需要一些建议。
我尝试过:
Dim _listofDrive as new 列表( string )
对于 每个 driveList 作为 IO.DriveInfo 在 IO.DriveInfo.GetDrives
Dim driveType 正如 字符串 = driveList.DriveType
Dim driveName 作为 字符串 = driveList.VolumeLabel
如果 IO.DriveType.Fixed 然后
_listofDrive.Add(driveName)
结束 如果
下一页
在这里:
< pre lang =vb> Dim _listofDrive As New 列表( 字符串)
对于 每个 d 作为 DriveInfo 在 DriveInfo.GetDrives()
如果 d.DriveType = DriveType.Fixed 那么
_listofDrive.Add(d.Name)
结束 如果
下一页
****** ************************************************** ***************
**由于当前的网站格式错误,下面的无格式版本:
Dim _listofDrive作为新列表(字符串)
每个d作为DriveInfo在DriveInfo.GetDrives()中
如果d.DriveType = DriveType.Fixed然后
_listofDrive.Add(d.Name)
结束如果
下一步
I am trying to store the list of drive from a pc into an array but I found that it doesn't store the information. I need some advice please.
What I have tried:
Dim _listofDrive as new List(of string)
For Each driveList As IO.DriveInfo In IO.DriveInfo.GetDrives
Dim driveType As String = driveList.DriveType
Dim driveName As String = driveList.VolumeLabel
If IO.DriveType.Fixed Then
_listofDrive.Add(driveName)
End If
Next
Here you go:
Dim _listofDrive As New List(Of String) For Each d As DriveInfo In DriveInfo.GetDrives() If d.DriveType = DriveType.Fixed Then _listofDrive.Add(d.Name) End If Next
***********************************************************************
** Unformatted version below due to current site formatting bug:
Dim _listofDrive As New List(Of String)
For Each d As DriveInfo In DriveInfo.GetDrives()
If d.DriveType = DriveType.Fixed Then
_listofDrive.Add(d.Name)
End If
Next
这篇关于Drive的volumelabel无法存储在数组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!