bool flagStop = false; void Run () { flagStop = false; ManualResetEvent waitHandle = new ManualResetEvent(false); for ( int i = 1; i <= 100000; i++ ) { Dispatcher.BeginInvoke(new ThreadStart(delegate { lb.Text = i.ToString(); })); waitHandle.WaitOne(1); if ( flagStop ) { break; } } } private void buttonStartFor_Click (object sender, RoutedEventArgs e) { Task ts = new Task(Run); ts.Start(); } private void buttonEndFor_Click (object sender, RoutedEventArgs e) { flagStop = true; }