T
tk
I am trying to write a VB.net program that will retrieve info about a
machines hard drive(s). When I try to do a calculation I get and error that
states: Operator is not valid for type 'UInt64' and type 'Integer'. I am
trying to divide the freespace by 1024. I have tried to declare a variable
as type uint64, but that did not work. Is there a way to convert the value
returned by WMI to a type that I can perform math on? Below is the code I am
running:
Dim colDisks As System.Management.ManagementObjectCollection
Dim objDisk As System.Management.ManagementObject
Const HARD_DISK = 3
colDisks = WmiConn.ExecWmiQuery("Select * from Win32_LogicalDisk Where
DriveType = " & HARD_DISK & "")
For Each objDisk In colDisks
F = objDisk.GetPropertyValue("freespace") / 1024
next
Any help would be appreciated.
Thanks.
machines hard drive(s). When I try to do a calculation I get and error that
states: Operator is not valid for type 'UInt64' and type 'Integer'. I am
trying to divide the freespace by 1024. I have tried to declare a variable
as type uint64, but that did not work. Is there a way to convert the value
returned by WMI to a type that I can perform math on? Below is the code I am
running:
Dim colDisks As System.Management.ManagementObjectCollection
Dim objDisk As System.Management.ManagementObject
Const HARD_DISK = 3
colDisks = WmiConn.ExecWmiQuery("Select * from Win32_LogicalDisk Where
DriveType = " & HARD_DISK & "")
For Each objDisk In colDisks
F = objDisk.GetPropertyValue("freespace") / 1024
next
Any help would be appreciated.
Thanks.