No files selected in openfiledialog

  • Thread starter Thread starter simonc
  • Start date Start date
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.
 
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
///
 
Back
Top