English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Public Function GetDiskSpace() 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
For Each disk In disks
If CStr(disk("Name")) = "C:" Then
space = CType(disk("FreeSpace"), System.UInt64)
End If
Next disk
Return space
End Function

2006-08-30 02:21:44 · 1 answers · asked by VBNewComer 1 in Computers & Internet Programming & Design

It gives error in

diskClass.GetInstances()

I have done it thru msgbox and exception handling too, but can't resolve why getinstances is not found ?

Thanks for answer, can you please help me further ?

2006-08-30 03:44:19 · update #1

1 answers

One of your management methods has returned a "not Found Exception" You have no exception handling wthin the code.

Use a Msgbox command to find out which command is not working or use exception handling for all commands.

If this is wrong then it is because I do not know VB!

2006-08-30 03:04:02 · answer #1 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers