From: simonc on
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.
From: Herfried K. Wagner [MVP] on
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
 | 
Pages: 1
Prev: making variables
Next: FileGet() only gets zeroes