System.Threading.ThreadAbortException(我们如何处理此异常?)

时间:2016-11-16 10:41:56

标签: c# winforms visual-studio-2015 threadabortexception

How can we handle this exception is there some alternative or where i have to make changes?

公共表格()         {             尝试             {                 线程t =新线程(新的ThreadStart(StartForm));                 t.Start();                 Thread.sleep代码(3200);                 的InitializeComponent();                 t.Abort();             }             catch(Exception ex)             {                 MessageBox.Show(ex.Message);             }         }         线程;

    public void StartForm()
    {
        Application.Run(new Form3());
    }

    private void button1_Click(object sender, EventArgs e)
    {
        this.Close();
        th = new Thread(opennewform);
        th.SetApartmentState(ApartmentState.STA);
        th.Start();
    }
    private void opennewform(object obj)
    {
        Application.Run(new Form2());

    }

This is the Screen Shoot of this Exception

0 个答案:

没有答案