Click here to Skip to main content
15,898,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can anybody help with some code, how to display all the folders and files using vb.net, and one more thing will be advantage that if i can select the folder too?
I tried this code but iam not getting output, simply it is executing

VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' make a reference to a directory
        Dim di As New IO.DirectoryInfo("c:\")
        Dim diar1 As IO.FileInfo() = di.GetFiles()
        Dim dra As IO.FileInfo

        'list the names of all files in the specified directory
        For Each dra In diar1
            ListBox1.Items.Add(dra)
        Next
    End Sub


Please help with some code.
Posted
Updated 8-May-10 2:43am
v2

1 solution

Anil Sarda wrote:
ListBox1.Items.Add(dra)

Try ListBox1.Items.Add(dra.FullName) instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900