Drive info

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hendrikbez via DotNetMonster.com

    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 .

    Code:
    Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
    Dim d As DriveInfo
    For Each d In allDrives
    
    lstdrives.Items.Add(d.Name)
    
    lstdrives.Items.Add(d.DriveType.ToString)
    If d.IsReady = True Then
    lstdrives.Items.Add(d.VolumeLabel)
    
    lstdrives.Items.Add("  free Bytes: " + d.AvailableFreeSpace.
    ToString + " " + " bytes")
    End If
    Next
    --
    Message posted via DotNetMonster.c om
    Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.


  • Christian Reizlein

    #2
    Re: Drive info

    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.c om" <u45658@uwewrot e in message
    news:8a38c38943 037@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 .
    >
    Code:
    >
           Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
           Dim d As DriveInfo
           For Each d In allDrives
    >
               lstdrives.Items.Add(d.Name)
    >
               lstdrives.Items.Add(d.DriveType.ToString)
               If d.IsReady = True Then
                   lstdrives.Items.Add(d.VolumeLabel)
    >
                   lstdrives.Items.Add("  free Bytes: " +
    d.AvailableFreeSpace.
    ToString + " " + " bytes")
               End If
           Next
    >
    >
    --
    Message posted via DotNetMonster.c om
    Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.

    >

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Drive info

      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.c om" <u45658@uweschr eef in bericht
      news:8a38c38943 037@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 .
      >
      Code:
      >
             Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
             Dim d As DriveInfo
             For Each d In allDrives
      >
                 lstdrives.Items.Add(d.Name)
      >
                 lstdrives.Items.Add(d.DriveType.ToString)
                 If d.IsReady = True Then
                     lstdrives.Items.Add(d.VolumeLabel)
      >
                     lstdrives.Items.Add("  free Bytes: " +
      d.AvailableFreeSpace.
      ToString + " " + " bytes")
                 End If
             Next
      >
      >
      --
      Message posted via DotNetMonster.c om
      Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.

      >

      Comment

      Working...