Alternative to OpenFileDialog?

  • Thread starter Thread starter Adam Honek
  • Start date Start date
A

Adam Honek

Given I have problems with using OpenFileDialog as explained in another
thread
here, what other options are there?

All I need is for the user to be able to browse for files and select one or
more. That's it.

Thanks
Adam
 
Adam,

Threads are not meant for UI operations, (while it is not impossible would I
like to avoid that just because of design).

Cor
 
A form is started in a thread.

Both font and color dialog controls open up and work fine.

openfiledialog just crashes out.

Adam
 
A form is started in a thread.

Both font and color dialog controls open up and work fine.

openfiledialog just crashes out.

Adam
Just a shot in the dark.

Are you using the FileDialog component or FileDialog Class?

I cannot get the ImageList compnent to work, here, to save my life,
but the ImageList Class works fine and is what I am having to use. The
component seems to work for others, however.

Perhaps, you are experiencing a similar querk.

Gene
 
The control.

Does the class also support firing up the GUI to select the file?

Adam
 
Adam Honek said:
A form is started in a thread.

Check the value 'System.Threading.Thread.CurrentThread.ApartmentState'
returns. If it's 'ApartmentState.MTA' set it to 'ApartmentState.STA'.
Both font and color dialog controls open up and work fine.

openfiledialog just crashes out.

All of those dialogs are internally based on Win32 API calls, and maybe some
of them only work with STA.
 
Followed your advice and finally.....it worked.

Why can't MS put this stuff in the help files beats me.

Thanks so much, problem solved.

Adam
 
Back
Top