Search
Categories
  ASP.NET
Visual C#
Visual Basic
.NET Framework
ADO.NET
AJAX
LINQ
Java
 
Tutorial Rating
 
5.0 out of 5


Total Votes: 1
         
1 2 3 4 5
 




Using DriveInfo class in VB.NET to get System Drives Information

Author: Waqas Anwar - Posted Date: 06-April-2008 - Category: Visual Basic   
Bookmark and Share
DriveInfo class in .NET Framework is very useful class you can use to get information about the system drives. It has many properties and methods to query drive information such as drive type, drive format, total size or total free space. In the following Tutorial I will show you how to use this class in VB.NET Windows Application.
 

DriveInfo class





Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim drives As DriveInfo() = DriveInfo.GetDrives()
    For Each drive As DriveInfo In drives
        Me.comboBox1.Items.Add(drive.Name)
    Next
End Sub

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim driveName As String = comboBox1.SelectedItem.ToString()
    Dim drive As New DriveInfo(driveName)
   
    label2.Text = "Drive Name: " + drive.Name
    label3.Text = "Volume Label: " + drive.VolumeLabel
    label4.Text = "Drive Type: " + drive.DriveType.ToString()
    label5.Text = "Drive Format: " + drive.DriveFormat
    label6.Text = "Total Size: " + (drive.TotalSize / 1024 / 1024 / 1024) + " GB"
    label7.Text = "Free Disk Space: " + (drive.TotalFreeSpace / 1024 / 1024 / 1024) + " GB"
    label8.Text = "Drive Ready: " + drive.IsReady.ToString()
End Sub




RELATED TUTORIALS

  How to get System Drives Information in C# using DriveInfo class
  How to use DriveInfo class in .NET 2.0

LEAVE YOUR COMMENTS LEAVE YOUR COMMENTS
 Name (required)  
 Email (required
 Website


 

 


 
 
 

Categories

My Portfolio

Website Links


Copyright @ 2009 EzzyLearning.com