CheckedLISTBOX > Load folder/Dir names (vb.net 2010 exp)

Hi Experts,

I'm trying to build a winform app with:
1. CheckedListBox1
1. WebBrowser1

on "Form1_Load", I want to load folder names form a specific directory into my CheckedListBox1.
if I check the foldername e.g. FolderA, it will load "FolderA\FolderA.html" into my WebBrowser1.

If asked similar questions regarding files in the past, but cannot adapt :(

Thanks,
Roberto
Private sourceFolder As String = "C:\sourcefolder\"
    Dim di As New DirectoryInfo(sourceFolder)


 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadFiles()
    End Sub


Private Sub CheckedListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckedListBox1.SelectedIndexChanged
        If Not (CheckedListBox1.SelectedItem Is Nothing) Then
            WebBrowser1.Navigate("C:\sourcefolder\")
        End If

Open in new window

RobertoFreemanoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobertoFreemanoAuthor Commented:
Ok, this lists dir's but I'd like to only show names & not full path.

Also: click event
ListBox1.Items.AddRange(IO.Directory.GetFiles("c:\sourcefolder"))

Open in new window

0
käµfm³d 👽Commented:
Try this:

For Each folder In IO.Directory.GetDirectories("c:\")
    ListBox1.Items.Add(IO.Path.GetFileName(folder))
Next

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
Also change

WebBrowser1.Navigate("C:\sourcefolder\")

to

WebBrowser1.Navigate(Checkedlistbox1.selecteditem.tostring() & ".htm")
0
RobertoFreemanoAuthor Commented:
Thanks Guys, I'll test this asap ;)
0
RobertoFreemanoAuthor Commented:
Thanks guys ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.