|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
'System.Management.ManagementClass' is not definedI am getting this error: Type 'System.Management.ManagementClass' is not
defined. The statement is: Dim diskClass As New System.Management.ManagementClass("Win32_LogicalDisk") According to the help file, this 'System.Management.ManagementClass' is under System.Object, so I put in the Imports System.Object in namespace, but that seems not to help. Any suggestions? Thanx in advance, Anil Gupte wrote:
> I am getting this error: Type 'System.Management.ManagementClass' is You need to add a reference to System.Management.dll, then it'll work.> not defined. The statement is: > Dim diskClass As New > System.Management.ManagementClass("Win32_LogicalDisk") HTH, -- (O)enone Thanx! That worked!
Show quoteHide quote "Oenone" <oen***@nowhere.com> wrote in message news:9Adah.21138$Fv1.19222@newsfe2-win.ntli.net... > Anil Gupte wrote: >> I am getting this error: Type 'System.Management.ManagementClass' is >> not defined. The statement is: >> Dim diskClass As New >> System.Management.ManagementClass("Win32_LogicalDisk") > > You need to add a reference to System.Management.dll, then it'll work. > > HTH, > > -- > > (O)enone > As I said it helpd, but raises another question.
What other options are there other than Win32_LogicalDisk? I want only local Read/Write Disks (I wan tot create a temporary file and I am trying to find the first disk that has enough space and I can write to). I did a searh in the help, but came up with nothing. There is some code: 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 But this does not help because it is Logical disk. I know there is an IsLocal property, but I wish there was a more direct way and also, will IsLocal give me the CD-ROM drive, which obviously I cannot write to. Thanx in advance, Show quoteHide quote "Oenone" <oen***@nowhere.com> wrote in message news:9Adah.21138$Fv1.19222@newsfe2-win.ntli.net... > Anil Gupte wrote: >> I am getting this error: Type 'System.Management.ManagementClass' is >> not defined. The statement is: >> Dim diskClass As New >> System.Management.ManagementClass("Win32_LogicalDisk") > > You need to add a reference to System.Management.dll, then it'll work. > > HTH, > > -- > > (O)enone >
Why is this simple addition throwing an overflow exception?
calling math functions at run time regarding .net help Good book for an absolute beginner on VB.net or 2005 with databases How to run and communicate a DOS program file in a VB.NET program? Can someone please translate this to VB.Net Problem saving txt box with enter key Opening...Closing Forms WIALib error need help with 1 line of code now! |
|||||||||||||||||||||||