Search
Tutorials
How TOs
Home
Top Tutorials
HOW TOs
Presentations
Web Services
Cheat Sheets
About Me
Contact Me
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
Saving...
Amazon.co.uk Widgets
Using DriveInfo class in VB.NET to get System Drives Information
Author:
Waqas Anwar
-
Posted Date:
06-April-2008
-
Category:
Visual Basic
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.
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
Name (
required
)
Email (
required
)
Website
Categories
ASP.NET
Visual C#
Visual Basic
.NET Framework
ADO.NET
AJAX
LINQ
Java
My Portfolio
My Portfolio Summary
Teaching and Training Experience
Speaking Accomplishments
Work Experience
Professional Skillset
Industry Honors and Awards
Educational Background
My Projects
Personal Information
Website Links
Programming HOW TOs
My Presentations
Free XML Web Services
Cheat Sheets
.NET Code Converter
.NET Framework Class Browser
About EzzyLearning
Advertise With Us
Subscribe to RSS Feeds
Copyright @ 2009 EzzyLearning.com