Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
Posted

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.

Posted

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..

Dream as if you'll live forever, live as if you'll die today

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...