HighTechTalks DotNet Forums  

No files selected in openfiledialog

VB.net microsoft.public.dotnet.languages.vb


Discuss No files selected in openfiledialog in the VB.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
simonc
 
Posts: n/a

Default No files selected in openfiledialog - 05-11-2010 , 08:46 AM






How can I test for openfiledialog OK clicked without any files being
selected? (I'm using it with multiple select as true.)

I've tried

if openfiledialog1.filenames = nothing then ...

and

if ubound(openfiledialog1.filenames) = -1 then ...

but both these give compile errors.

Grateful for advice.

Reply With Quote
  #2  
Old   
Herfried K. Wagner [MVP]
 
Posts: n/a

Default Re: No files selected in openfiledialog - 05-11-2010 , 08:58 AM






Am 11.05.2010 15:46, schrieb simonc:
Quote:
How can I test for openfiledialog OK clicked without any files being
selected? (I'm using it with multiple select as true.)

I've tried

if openfiledialog1.filenames = nothing then ...

and

if ubound(openfiledialog1.filenames) = -1 then ...

but both these give compile errors.
At least on Windows 7 I am not able to close the dialog by clicking the
"OK" button if no file is selected.

Maybe you are attempting to check if the "Cancel" button has been pressed?

\\\
If Me.OpenFileDialog1.ShowDialog() =
System.Windows.Forms.DialogResult.OK Then
...
Else
...
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.