我的接收文件程序,接收的操作是自己开的一个线程来实现的 部分代码:
if (MessageBox.Show("是否接收文件", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                    == DialogResult.Yes)
                {
                   OpenFileDialog openFileDialog1 = new OpenFileDialog();
                    DialogResult result = openFileDialog1.ShowDialog();
                    //异常在showDialog这里抛出                    if( result == DialogResult.OK )
                
                    {
                        fs = new FileStream(openFileDialog1.FileName, FileMode.Create,
                                                FileAccess.ReadWrite);
                    }
                }异常:ThreadStateExpection
(
在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。 只有将调试器附加到该进程才会引发此异常。)
请问高手原因是什么啊?怎么解决?