Tuesday, 15 April 2014

Getting LogicalDrive Info

 private void button3_Click(object sender, EventArgs e)
        {
            String[] obj = System.Environment.GetLogicalDrives();
            //obj.show
            comboBox1.Items.AddRange(obj);
           
            listBox1.Items.AddRange(obj);


        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.BackColor = System.Drawing.Color.DarkGreen;
            System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
            for (int i = 0; i <= drives.Length - 1; i++)
            {
                comboBox1.Items.Add(drives[i].Name);
            }
            comboBox1.SelectedIndex = -1;
         
        }

No comments:

Post a Comment