Alternative to OpenFileDialog?

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
 
C

Cor Ligthert [MVP]

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

Adam Honek

A form is started in a thread.

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

openfiledialog just crashes out.

Adam
 
G

gene kelley

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
 
A

Adam Honek

The control.

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

Adam
 
H

Herfried K. Wagner [MVP]

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

Adam Honek

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
 

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