Ryan

Ryan

  • NA
  • 15
  • 0

DriveInfo question

Dec 27 2008 7:38 PM

Im trying to get hard drive info and output it using Textbox.ReflectMessage. any idea how to do this

 

this is my code:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

namespace procCount

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

DriveInfo[] allDrives = DriveInfo.GetDrives();

foreach (DriveInfo c in allDrives)

{

TextBox.ReflectMessage = "Drive {0}" + c.Name;

TextBox.ReflectMessage = " File type: {0}" + c.DriveType;

if (c.IsReady == true)

{

TextBox.ReflectMessage = " Volume label: {0}" + c.VolumeLabel;

TextBox.ReflectMessage = " File system: {0}" + c.DriveFormat;

TextBox.ReflectMessage = " Available space to current user: {0, 100} bytes" + c.AvailableFreeSpace;

TextBox.ReflectMessage = " Total available space: {0, 100} bytes" + c.TotalFreeSpace;

TextBox.ReflectMessage = " Total size of drive: {0, 100} bytes" + c.TotalSize;

}

}

}

}

}

 

the out put i get is:

 

File type: {0}CDRom

 

and its in a text box just now showing me the info ....

 

 

thank you for your time.


Answers (4)