Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
System.Management.ManagementBaseObject
Message
From
10/11/2004 03:49:30
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
System.Management.ManagementBaseObject
Environment versions
Environment:
VB.NET 1.1
OS:
Windows '98
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00959883
Message ID:
00959883
Views:
41
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
Map
View

Click here to load this message in the networking platform