FileListBox Pattern

Hi,

In my application, I need the FileListBox to display only files with these extentions: BMP, GIF, JPEG.

I use this syntax:

filFileBox.Pattern = "*.BMP; *.JPEG; *.GIF"

But it doesn't work. I can see the DirListBox items, and the DriveListBox too, but I can't see anything in the FileListBox...why?

Thanks!
LVL 1
meravknAsked:
Who is Participating?
 
appariCommented:
actually this is problem because of spaces in pattern string. try removing spaces

filFileBox.Pattern = "*.BMP;*.bmp;*.JPEG;*.jpeg;*.GIF;*.gif"

Rao
0
 
OtanaCommented:
I believe the pattern property is case sensitive. try this:

filFileBox.Pattern = "*.BMP; *.bmp; *.JPEG; *.jpeg; *.GIF; *.gif"

0
 
appariCommented:
are you setting the correct Path?

try setting

filFileBox.Path property and check
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
appariCommented:
actually this is problem because of spaces in pattern string. try removing spaces

filFileBox.Pattern = "*.BMP;*.JPEG;*.GIF"

Rao
0
 
OtanaCommented:
appari is right. remove the spaces from your string. the Microsoft Help File is incorrect on this: it shows an example using spaces, but it doesn't work.
0
 
hakobCommented:
Perhaps you have missing something. Please, follow the steps to create a sample project. then compare with your:

1. Create a standard EXE project. Form1 is created by default.

2. Place a FileList box (File1) on Form1.

3. Place a CommandButton on Form1 and place the following code in the click event:

File1.Path = "c:\windows" ' Put here your windows dir or
                          ' some other dir.    
File1.Pattern = "*.bmp; *.gif; *.jpeg"
 
Press the F5 key to run the application the files with the crresponding extention are displayed in the FileListBox.

0
 
TimCotteeHead of Software ServicesCommented:
hakob, please re-read the guidelines on comments vs answers at the bottom of this page. You have submitted an "answer" which adds nothing to the thread, noting that the correct solution has already been supplied in a number of comments and that your "answer" is incorrect in that it still includes the spaces that are the root of this problem. If you continue to post "answers" in this manner your account will be referred to customer services for possible penalty. You are not new to EE so should be more than aware of the protocol on this site.
0
 
meravknAuthor Commented:
That worked! thank you very much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.