Tình hình là em có đoạn code thế này
Nhưng mà khi chạy nó toàn báo lỗi :sosad:
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.
tìm google thì nó bảo là thêm
[STAThread] vào trước Main. Em cũng làm rồi mà nó lại báo lỗi
945335_279941482141272_1069804326_n.jpg
Hồi trước cũng bị. cài lại win thì chạy được, nhưng sau khi để tự động update thì nó bị vậy?
Không biết phải sữa thế nào mong các pro chỉ dùm:tire:
Xin cảm ơn
PHP Code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
string fileName;
fileName = dlg.FileName;
MessageBox.Show(fileName);
}
}
}
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.
tìm google thì nó bảo là thêm
[STAThread] vào trước Main. Em cũng làm rồi mà nó lại báo lỗi
945335_279941482141272_1069804326_n.jpg
Hồi trước cũng bị. cài lại win thì chạy được, nhưng sau khi để tự động update thì nó bị vậy?
Không biết phải sữa thế nào mong các pro chỉ dùm:tire:
Xin cảm ơn
Comment