Code sample to display the available drives on your computer in VB.NET

Code sample to display the available drives on your computer in VB.NET


Here is an example written in Visual Basic that displays available drives on a computer. Few lines are enough to get the information. Add lines in your code to enhance your program if you wish.

Code sample to display the available drives on your computer in VB.NET




        

Visual Studio 2010


    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
   
        For Each drive As System.IO.DriveInfo In System.IO.DriveInfo.GetDrives
            MessageBox.Show(drive.Name.ToString)
        Next

    End Sub

End Class



The example in this article uses a Windows Forms type. Using a Button1 is only intended to make the program attractive. Press Button1 to start viewing drives available. The program does not differentiate between different types of drives such as USB keys, DVD-ROM or SIM card.

Reference :

Download the sample project: SampleDisplayDrives.zip

0 Response to "Code sample to display the available drives on your computer in VB.NET"

Posting Komentar