Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

OpenFileDialog Freaks out C#

$
0
0

OpenFileDialog1.ShowDialog();

txtPresSDFPath.Text = OpenFileDialog1.FileName;

When I click the button to open the FileDialog the app errors out in debug mode stating the following error:

System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made.  Ensure that your Main function has STAThreadAttribute marked on it.  This exception is only raised if a debugger is attached to the process....

Any ideas?

TIA

Harry


Viewing all articles
Browse latest Browse all 31927

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>