1 Replies - 193 Views - Last Post: 27 December 2019 - 12:49 PM Rate Topic: -----

#1 NithinMohan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-December 19

I want to get all logical drives in ListBox1

Posted 27 December 2019 - 11:39 AM

I Want to add all logical drives Instead of "C:\" Drive.This code gets me only drive letter "C".

Private Sub FullScanButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FullScanButton.Click
        ListBox1.Items.Clear()
        ListBox2.Items.Clear()
        Timer1.Start()
        scanSubfolders(Environment.SystemDirectory, Me.ListBox1)
        TabControl1.SelectTab(0)
        ProgressBar1.Update()
        Label12.Text = "Scanning"
        Label10.Text = "Full Scan"
        WriteTolog("Full Scan Started" + " " + Date.Today + " " + TimeOfDay)
    End Sub

    Private Sub fullscan_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles fullscan.DoWork
        CheckForIllegalCrossThreadCalls = False
        fullscan.WorkerSupportsCancellation = True
        scanSubfolders("C:\", Me.ListBox1)
    End Sub

    Private Sub full_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles full.Tick
        scanSubfolders("C:\", Me.ListBox1)
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: I want to get all logical drives in ListBox1

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15477
  • View blog
  • Posts: 62,006
  • Joined: 12-June 08

Re: I want to get all logical drives in ListBox1

Posted 27 December 2019 - 12:49 PM

Per the documentation, use IO.DriveInfo.GetDrives().

https://docs.microso...etframework-4.8
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1