Page 1 of 1
Folder Browser Dialog
Posted: Fri May 25, 2007 8:48 pm
by jebmodillion
Hi everyone,
I am using Visual Basic
I need some help... Duh
What I need is: when I use the folder browser dialog I want the selected folder's files to be displayed in a listbox.
Also, I need the filter to be .map
Thanks ahead of time
If you help me you will get credit when my program is released on halomods.
Posted: Sat May 26, 2007 6:32 am
by Dagger13
u dont use folder browsing dialog u use open file dialog
Posted: Sat May 26, 2007 12:22 pm
by jebmodillion
Dagger13 wrote:u dont use folder browsing dialog u use open file dialog
hahahahaha.....
Well you either don't know what you are talking about or you did not read it correctly.
If you are just learning(most Likely) don't post on my question
This is what I want:
when I use the folder browser dialog(it is already tied up to a button) I want the selected folder's files to be displayed in a listbox.
Its very simple
I don't need open file dialog becuase you can only open one file and not a floder.
Posted: Sat May 26, 2007 12:42 pm
by -DeToX-
I haven't coded VB for a while.
Code: Select all
Dim f As New FolderBrowserDialog
If f.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim s As String()
s = Directory.GetFiles(f.SelectedPath)
For i As Integer = 0 To s.Length - 1
Dim s2 As String()
s2 = s(i).Split("\")
ListBox1.Items.Add(s2(s2.Length - 1))
Next
End If
That will add the filename + filetype. Example "hello.jpg".
Or...
For full path("C:\Documents and settings\ blahblah\hello.jpg") do this...
Code: Select all
Dim f As New FolderBrowserDialog
If f.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim s As String()
s = Directory.GetFiles(f.SelectedPath)
For i As Integer = 0 To s.Length - 1
ListBox1.Items.Add(s(i))
Next
End If
Posted: Sat May 26, 2007 3:21 pm
by jebmodillion
Hey detox
Thank you so much!!!
I will give you credit for helping me.
Thanks again!
Posted: Sat May 26, 2007 3:32 pm
by Dagger13
o i didnt no what u meant
and no im not just learning