
03-03-2003, 11:35 AM
|
 |
Jedi Coder
* Expert *
|
|
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
|
|
|
You can set the Filter property of the CommonDialog control to only show files with a certain extension (txt, csv, etc.):
CommonDialog1.Filter = "Text (*.txt)|*.txt|CSV Files(*.csv)|*.csv"
That will at least limit the amount of wrong files that can be selected. You would still have to have error handling in your application to catch parsing errors if a text file that isn't properly formatted is selected. There's nothing in the selection process that can guarantee that a wrong file isn't selected.
BTW - you might want to add an:
Exit Sub
before your error handler label.
|
|