Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15567

GetFiles - Mutiple File Ext Patterns

$
0
0
Hey all,

I am using the below code to fill a listbox with just exensions I want.

If I just do "*.jpg" by itself it works fine. Loads all files with that extension

However, I am trying to add multiple extensions patterns, but my list box goes blank.

Code:

Dim filesI As New List(Of String)
Dim fileStrI
fileStrI = txtIMG.Text & "\"
filesI.AddRange(IO.Directory.GetFiles(fileStrI, "*.jpg,*.png").  '<--- DOESN'T WORK AT RUNTIME - NO ERRORS AT DESIGNTIME
    Select(Function(f) IO.Path.GetFileName(f)))
ListBox3.Items.Clear()
ListBox3.Items.AddRange(filesI.ToArray)

I know I don't have this right.
I have been doing a lot of digging on Google and many offer sample code, but none if them seem to work.

Can any one help me with this??

Thanks in advance

Viewing all articles
Browse latest Browse all 15567

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>