Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I am making a program that shows the type of the user inputted drive by drive letter like pen drive , local disk , cd drive, sdhd, system drive (c:).

What I have tried:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        dfunton(TextBox1.Text)
    End Sub

    Private Sub dfunton(ByVal p1 As Object)
        'code for getting drive type
        Label1.Text = "drivetype"
    End Sub

End Class
Posted
Updated 19-Jan-18 17:48pm
v2

Look at the DriveInfo Class (System.IO)[^] - it returns the info you need.
 
Share this answer
 
Comments
Member 13607190 19-Jan-18 12:24pm    
I Only need info of a specific drive letter, Not Every Drive.
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        dfunton(TextBox1.Text)
    End Sub

    Private Sub GetDrivetype(ByVal drive As String)
        Try
            Dim Drive_Info As System.IO.DriveInfo
            Drive_Info = New System.IO.DriveInfo(drive)
            Label1.Text = Drive_Info.DriveType.ToString
        Catch ex As Exception
            MsgBox(ex.Data)
        End Try
    End Sub

End Class
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900