Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the Hard Drive List in the computer

Status
Not open for further replies.

tonioJ

Programmer
Oct 7, 2002
90
PH
hello there!

does anyone there has created a code for getting the drive list in the computer? I'm trying to make a component in VB.Net for getting the list of hard drives attached in the computer. Pls. give me a sample code. thanks a lot!

I have a code below but it always return an error

here's the code

dim myComputerObj as new System.FileSystemObject()

Private Sub GetDriveList()
dim iCtr as integer
dim drvLetter as string

for iCtr = 0 to myComputerObj.Drives.Count()
drvLetter = myComputerObj.Drives.Item(ictr).DriveLetter.toString()
next

End Sub

the error returned in this code is incorrect parameters.
 
Code:
For Each drv As String In System.IO.Directory.GetLogicalDrives()
    MsgBox(drv)
Next

stravis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top