OpenFileDialog - File Dialog box is not appearing

Hi

Please see the attached. All I’m trying to do is pop up a dialog for the user to select a file, in order for me to then grab the selected filename and path.

The automation reaches as far as the openFileDialog (ShowDialog), but then stops, WITHOUT displaying the dialog.

Any ideas why this might be happening or how I might investigate further?

I’m running version 19.1.70

Many thanks.

Paul

@PaulB784 The dialog needs to be shown off of a Windows Form thread. You will need this method called off of the Click event of a button on a Windows Form. Let me know if you need an example.

@ThomasSasnett

Thanks Thomas, I get the dialog now.

What I need though is the full file path of the file selected in the dialog. how do I get that…it just seems to bring back a string array in the File Properties>Filenames component.

If you have an example, that might be useful.

Regards,

Paul

@PaulB784 You should use the FileName (no S) property of the Dialog. FileNames (S at the end) is used if you enable MultiSelect on the Dialog and want to get an array of all of the files they selected. In that case, you’d pass that to a ListLoop to iterate over that array to get to each one.

@ThomasSasnett

Ahh, sorry, it’s in a different place to Filenames. Didn’t spot that.

Thanks for your help - all good now.

Regards.

Paul