Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DISPLAYING SUB DIRECTORIES ON WIN FORM IN VB NET

Posted on 2006-06-20
1
Medium Priority
?
254 Views
Last Modified: 2010-04-23
i WANT TO DISPLAY IN A LISTBOX ALL THE SUB DIRECTORIES IN A DIRECTORY ON FORM OPEN. tHIS IS TO BE DONE IN WIN FORMS OF VB NET
0
Comment
Question by:abobby2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 16946190
Something like...

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DisplayFolders(ListBox1, "c:\some\Folder\path")
    End Sub

    Private Sub DisplayFolders(ByVal lb As ListBox, ByVal parentFolder As String)
        Try
            Dim di As New System.IO.DirectoryInfo(parentFolder)
            If di.Exists Then
                lb.BeginUpdate()
                lb.Items.Clear()
                lb.Items.AddRange(di.GetDirectories)
                lb.EndUpdate()
            Else
                MessageBox.Show("parentfolder = " & parentFolder, "Path Not Found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message & vbCrLf & "parentfolder = " & parentFolder, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

End Class
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question