cheshirefire
asked on
Populate list box with multiple file types
I want to populate a list box from a directory with multiple particular file types, jpg or bmp or dwf only. can anyone suggest some code for vb express 2008.
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Text = "c:\test\"
Dim files() As String = IO.Directory.GetFiles(TextBox1.Text)
ListBox1.Items.Clear()
For Each file As String In files
ListBox1.Items.Add(IO.Path.GetFileName(file))
Next
End Sub
ASKER
My apologies what I meant was *.jpg AND *.bmp AND *.dwf exclusively.
The directory has several other file types that another program uses i.e. htm's, txt's so all I want are the above file types.
thanks
The directory has several other file types that another program uses i.e. htm's, txt's so all I want are the above file types.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks to you all, problem solved
Dim files() As String = IO.Directory.GetFiles(Text
See
http://msdn.microsoft.com/en-us/library/ms143316.aspx