karthicmurugan
New member
- Joined
- Apr 17, 2020
- Messages
- 3
- Programming Experience
- 3-5
Public Structure HDDAll
Dim sHDD_Drive As String
Dim sHDD_FileSystem As String
Dim sHDD_VolumName As String
Dim sHDD_DriveType As String
Dim sHDD_TotalSize As Long
Dim sHDD_AvailableSize As Long
End Structure
Public Function GetAllDrive(sHAll() As HDDAll)
Dim a As String = ""
'structure HDDAll contain
Dim sHA() As HDDAll
For Each drive_info As DriveInfo In DriveInfo.GetDrives()
Select Case drive_info.DriveType
Case drive_info.DriveType.Fixed
For i As Integer = 0 To drive_info.DriveType.Fixed
sHA(i).sHDD_Drive = drive_info.Name.ToString
sHA(i).sHDD_DriveType = drive_info.DriveType.ToString
sHA(i).sHDD_VolumName = drive_info.VolumeLabel.ToString
sHA(i).sHDD_TotalSize = Val(drive_info.TotalSize)
sHA(i).sHDD_AvailableSize = Val(drive_info.AvailableFreeSpace)
Next
End Select
Next drive_info
sHAll = sHA
End Function
please any one rectify nullreference exception
Dim sHDD_Drive As String
Dim sHDD_FileSystem As String
Dim sHDD_VolumName As String
Dim sHDD_DriveType As String
Dim sHDD_TotalSize As Long
Dim sHDD_AvailableSize As Long
End Structure
Public Function GetAllDrive(sHAll() As HDDAll)
Dim a As String = ""
'structure HDDAll contain
Dim sHA() As HDDAll
For Each drive_info As DriveInfo In DriveInfo.GetDrives()
Select Case drive_info.DriveType
Case drive_info.DriveType.Fixed
For i As Integer = 0 To drive_info.DriveType.Fixed
sHA(i).sHDD_Drive = drive_info.Name.ToString
sHA(i).sHDD_DriveType = drive_info.DriveType.ToString
sHA(i).sHDD_VolumName = drive_info.VolumeLabel.ToString
sHA(i).sHDD_TotalSize = Val(drive_info.TotalSize)
sHA(i).sHDD_AvailableSize = Val(drive_info.AvailableFreeSpace)
Next
End Select
Next drive_info
sHAll = sHA
End Function
please any one rectify nullreference exception