473,382 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Drive info

I have this code and want to know how can I only get the fixed drive, (HDD
drives) to show and not the map or dvd drives, and how can I make it that it
shown bytes in this format 111,111,111,111.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
  3. Dim d As DriveInfo
  4. For Each d In allDrives
  5.  
  6. lstdrives.Items.Add(d.Name)
  7.  
  8. lstdrives.Items.Add(d.DriveType.ToString)
  9. If d.IsReady = True Then
  10. lstdrives.Items.Add(d.VolumeLabel)
  11.  
  12. lstdrives.Items.Add("  free Bytes: " + d.AvailableFreeSpace.
  13. ToString + " " + " bytes")
  14. End If
  15. Next
  16.  
  17.  
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200809/1

Sep 15 '08 #1
2 1749
Use an if statment to determine if the drive is fixed or not, like this
If Not d.DriveType = DriveType.Fixed Then Continue For

And for format the number of bytes use the FormatNumber() function, that
should do the work.

-CR
"hendrikbez via DotNetMonster.com" <u45658@uwewrote in message
news:8a38c38943037@uwe...
>I have this code and want to know how can I only get the fixed drive, (HDD
drives) to show and not the map or dvd drives, and how can I make it that
it
shown bytes in this format 111,111,111,111.

Expand|Select|Wrap|Line Numbers
  1.        Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
  2.        Dim d As DriveInfo
  3.        For Each d In allDrives
  4.            lstdrives.Items.Add(d.Name)
  5.            lstdrives.Items.Add(d.DriveType.ToString)
  6.            If d.IsReady = True Then
  7.                lstdrives.Items.Add(d.VolumeLabel)
  8.                lstdrives.Items.Add("  free Bytes: " +
  9. d.AvailableFreeSpace.
  10. ToString + " " + " bytes")
  11.            End If
  12.        Next
  13.  

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200809/1
Sep 15 '08 #2
Hedrik,

As you have version 2008, then try Linq, on Internet is your problem mostly
described to show how Linq to Object works

Cor
"hendrikbez via DotNetMonster.com" <u45658@uweschreef in bericht
news:8a38c38943037@uwe...
>I have this code and want to know how can I only get the fixed drive, (HDD
drives) to show and not the map or dvd drives, and how can I make it that
it
shown bytes in this format 111,111,111,111.

Expand|Select|Wrap|Line Numbers
  1.        Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
  2.        Dim d As DriveInfo
  3.        For Each d In allDrives
  4.            lstdrives.Items.Add(d.Name)
  5.            lstdrives.Items.Add(d.DriveType.ToString)
  6.            If d.IsReady = True Then
  7.                lstdrives.Items.Add(d.VolumeLabel)
  8.                lstdrives.Items.Add("  free Bytes: " +
  9. d.AvailableFreeSpace.
  10. ToString + " " + " bytes")
  11.            End If
  12.        Next
  13.  

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200809/1

Sep 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: GregT | last post by:
I program in C#. Is there a way to determine which of the local machine's logical drives are associated with CD drive(s)?
2
by: Henry Reardon | last post by:
I have a question or two about the Info Center. I'm running DB2 (LUW) Personal (Developer's) Edition Version 8 (FP8) on Windows XP. I just reinstalled DB2 V8 (FP7) and applied FP8 immediately...
5
by: will.leighton | last post by:
I am working on concept where I want to deliver web-based content and functionality from a USB Flash drive for users who don't have access to the Internet. The functionality includes personaliztion...
2
by: Peter O'Reilly | last post by:
I am experiencing difficulty access a mapped network drive in an ASP.NET application. While using the .Net framework v 1.1 implementation of System.IO.Directory.Exists(), it fails to recognize a...
14
by: frostalicious | last post by:
Used VB.NET (on my client PC) to convert VB6 executable to .NET executable. Placed the .exe file on a network drive on my server. From client, ran .NET Wizards "Trust an Assembly" to make the...
1
by: maz01 | last post by:
Hello All, I am developing an application in visual basic 2005 that will run continuously in the background on a users workstation. This application will automatically transfer files from the...
2
by: rick11 | last post by:
I need know when a drive is a USB drive, what USB port is it in? For the system I am doing this on, I do not have to worry about hubs plugged into hubs (into hubs...). It's just the motherboard...
23
by: Rotsey | last post by:
Hi, I am writing an app that scans hard drives and logs info about every fine on the drive. The first iteration of my code used a class and a generic list to store the data and rhis took...
2
by: =?Utf-8?B?Y29taXQy?= | last post by:
itried to install xp home edition . everything was loading ok untill eror message that os couldnot find hard disk drive. upon opening bios it shows my cd drive as primary and my dvd drive as...
0
by: TG | last post by:
hi! I am working with VB 2008. I want to be able to run this program say in N:\ and it will show me in an excel sheet the following: Folder Path Size(GB) Count of Files N:\Clients 0.53 308 ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.