Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 23rd, 2005, 5:22 AM   #1
Ithaqua
Newbie
 
Join Date: Oct 2005
Location: The othe side
Posts: 19
Rep Power: 0 Ithaqua is on a distinguished road
OpenFileDialog Problems

I have this weired problem in that when my dialog comes up it shows no files in the directory. I have checked and there are 3 files in the directory, 1 txt file and 2 MDB files. If I select all files it shows all 3.

The Code I am using is:
With OpenFileDialog1

   .Filter = "Text Files (*.txt) | *.txt | E-Mails (*.eml) | *.eml | All Files (*.*) | *.*"



If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

                    ' Do something
End If

End With

Can any one spot the problem or offer some advise?
__________________
Cheers
Ithaqua
Ithaqua is offline   Reply With Quote
Old Oct 23rd, 2005, 7:02 AM   #2
Ithaqua
Newbie
 
Join Date: Oct 2005
Location: The othe side
Posts: 19
Rep Power: 0 Ithaqua is on a distinguished road
Commenting out the filter line brings up the dialog in the right directory and it shows all 3 files.
__________________
Cheers
Ithaqua
Ithaqua is offline   Reply With Quote
Old Oct 23rd, 2005, 7:21 AM   #3
Ithaqua
Newbie
 
Join Date: Oct 2005
Location: The othe side
Posts: 19
Rep Power: 0 Ithaqua is on a distinguished road
Sorted it out.

.Filter = "Text Files (*.txt) | *.txt | E-Mails (*.eml) | *.eml | All Files (*.*) | *.*"

I had a extra space after the file extenstion. :mad:

it should have been
.Filter = "Text Files (*.txt) | *.txt| E-Mails (*.eml) | *.eml| All Files (*.*) | *.*"
__________________
Cheers
Ithaqua
Ithaqua is offline   Reply With Quote
Old Oct 23rd, 2005, 8:06 AM   #4
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
You're creating an array of atoms ready to be Split() using the | character. There should be no spaces either side of the pipes, unless you want to search for filenames starting or ending with a space (which you might), it was not a syntax error as such.
Rory is offline   Reply With Quote
Old Oct 23rd, 2005, 9:41 AM   #5
Ithaqua
Newbie
 
Join Date: Oct 2005
Location: The othe side
Posts: 19
Rep Power: 0 Ithaqua is on a distinguished road
Cheers
__________________
Cheers
Ithaqua
Ithaqua is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:00 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC