Folder Browser Dialog

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
jebmodillion
Readers Club





Posts: 41
Joined: Sun Apr 08, 2007 9:43 pm

Folder Browser Dialog

Post 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.
User avatar
Dagger13





Posts: 370
Joined: Wed Nov 22, 2006 12:37 pm

Post by Dagger13 »

u dont use folder browsing dialog u use open file dialog
Image(An Old one.)
User avatar
jebmodillion
Readers Club





Posts: 41
Joined: Sun Apr 08, 2007 9:43 pm

Post 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.
-DeToX-




Illusionist Recreator Connoisseur Acolyte
Sigma Decryptor Droplet Pyre
Blacksmith Socialist New Age System Engineer
ONI

Posts: 4589
Joined: Sun Jun 18, 2006 3:58 pm
Location: ...

Post 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
Image
User avatar
jebmodillion
Readers Club





Posts: 41
Joined: Sun Apr 08, 2007 9:43 pm

Post by jebmodillion »

Hey detox
Thank you so much!!!


I will give you credit for helping me.

Thanks again!
User avatar
Dagger13





Posts: 370
Joined: Wed Nov 22, 2006 12:37 pm

Post by Dagger13 »

o i didnt no what u meant

and no im not just learning
Image(An Old one.)
Post Reply