Worrow Posted November 6, 2003 Posted November 6, 2003 Is there any way to detect the number of HD using VB .NET? I have managed to get the number of all disk drive(floppy, HD, CD) with Management Object Collection. But couldn't tell which one is which. Any idea? Quote
Administrators PlausiblyDamp Posted November 6, 2003 Administrators Posted November 6, 2003 What code are you using at the moment to find the drives? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Worrow Posted November 6, 2003 Author Posted November 6, 2003 Somthing like below imports.system.management ... Dim diskClass As _ New ManagementClass("Win32_LogicalDisk") Dim disks As ManagementObjectCollection = _ diskClass.GetInstances() Dim disk As New ManagementObject For Each disk In disks Label1.Text &= disk.Properties("Name").ToString & vbCrLf Next disk ------------------------------------------------------------------------------- The codes above only shows all the drive letters, nothing more. Quote
Mehyar Posted November 6, 2003 Posted November 6, 2003 Use System.Environment.GetLogicalDrives() It will retun an array of strings it will give you A:/ C:/ D:/ etc ... but will not include CD drives only floppy, harddisks,newtork drives.. Hope this helps.. Quote Dream as if you'll live forever, live as if you'll die today
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.