General information
Title:
System.Management.ManagementBaseObject
Environment versions
Network:
Windows 2000 Server
Dear The Expert,
I ran below function (GetDiskSize function) on XP, it works correctly without any error or warning.. but when I try to run on Win 98SE it returned with the following error message:
The type initializer of System.Management.ManagementBaseObject threw an exception
Public Function GetDiskSize(ByVal pDrive As String) As System.UInt64
Dim mDrive As String
Dim diskClass As New System.Management.ManagementClass("Win32_LogicalDisk")
Dim disks As System.Management.ManagementObjectCollection = _
diskClass.GetInstances()
Dim disk As System.Management.ManagementObject
Dim space As System.UInt64
mDrive = pDrive.Trim & ":"
For Each disk In disks
If CStr(disk("Name")) = mDrive Then
space = CType(disk("Size"), System.UInt64)
End If
Next disk
Return space
End Function
Please advise .. many thanks in advance
Regards
Winanjaya
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only