Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How to know Your Logical Disk Drives

Author: DevASP
Download Source Code : 319_GetAllLogicalDrives.zip

When you make partion of your hard disk you make three kinds of drives primary, extended and logical. This article is about how you can get all the logical drives of your hard disk.

  • Steps you will do.
  • Start visual studio and create a new window application.
  • Set the following properties of your form.

Name = frmMain

Text = Logical Drives

FormBoarderStyle = FixedSingle

Maximize = False

  • Now drop a ComboBox control on your form and set its following properties

Name = cbDrive

DropDownStyle = DropDownList

  • Drop a Button control on your form and set following properties of it.

Name = btDrive

Text = Get Drives

  • Now open your code window and write the following code in the click event of your Button control “btDrive”.

Dim drives() As String

drives = Directory.GetLogicalDrives()

Dim aDrive As String

cbDrive.Items.Clear()

For Each aDrive In drives

cbDrive.Items.Add(aDrive)

Next

cbDrive.SelectedIndex = 0

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to Empty all the Textboxes of your Windows Form

Disclaimer - Privacy
© 2002-2017 DevASP.net