System.Threading.ThreadAbortException (How can we handle this Exception?)

871 Views Asked by At
How can we handle this exception is there some alternative or where i have to make changes?

public Form() { try { Thread t = new Thread(new ThreadStart(StartForm)); t.Start(); Thread.Sleep(3200); InitializeComponent(); t.Abort(); } catch(Exception ex) { MessageBox.Show(ex.Message); } } Thread th;

    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

There are 0 best solutions below