No files selected in openfiledialog

S

simonc

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.
 
H

Herfried K. Wagner [MVP]

Am 11.05.2010 15:46, schrieb simonc:
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
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top