Discussion:
OpenFileDialog filter
(too old to reply)
Jack Gerber
2012-09-02 01:08:22 UTC
Permalink
I am just getting started with VB 2010 and am using Teach Yourself Visual Basic in 24 Hours. At the very beginning the author says to add a property to the OpenFileDialog control called "Filter" Unless I am doing something completely wrong, there is no such property. Do I now have to add that in code by hand or did I miss something?

Any help appreciated.
Mike Williams
2012-09-02 08:38:38 UTC
Permalink
Post by Jack Gerber
I am just getting started with VB 2010 and am using
Teach Yourself Visual Basic in 24 Hours.
You can't teach yourself anything in 24 hours, except perhaps how to tie
your shoe laces!
Post by Jack Gerber
At the very beginning the author says to add a property to the
OpenFileDialog control called "Filter" Unless I am doing
something completely wrong, there is no such property.
Do you actually have the Properties window open and visible? If not then
right click the OpenFileDialog Control and select Properties. Then in the
Properties window left click the little button immediately to the left of
the button that looks like a lightning bolt to senure that it is displaying
Properties rather than Events. Then scroll down the list and you should see
the Filter property, against which you can type in some text . . . although
setting a value for that specific property at design time in this way is not
usually a very useful thing to do . . .
Post by Jack Gerber
Do I now have to add that in code by hand
Erm, well, Yes. Typing code by hand is a good thing to do. It's called
"programming" ;-) In fact instead of doing what I have half heartedly
suggested above it would be far better to left click the OpenFileDialog
Dialog control and then hit the F1 key on your keyboard (after first making
sure that you are connected to the Internet). When you want help with
anything you are doing then that is always the very first thing you should
do (left click on whatever you want help with and hit the F1 key).

If you scroll down the help file page which appears when you have done the
above you will see the various Properties and Methods and Events which are
applicable to the OpenFileDialog. Have a look for the Filter property and
read the brief description of what it does. Then left click the word
"Filter" and another help file page will open containing more information
about the Filter property and some code examples.
Post by Jack Gerber
or did I miss something?
Yes. You missed the F1 key. Make F1 your friend ;-)

Mike

Loading...