private void button2_Click(object sender, EventArgs e) { Thread thread = new Thread(() => { Tools.BubbleSort(int.Parse(DeleyTime.Text)); MessageBox.Show("Done"); }); thread.Start(); }