private void cmdFind_Click(object sender, EventArgs e) { // Disable the button. cmdFind.Enabled = false; txtResults.Text = ""; lblTimeTaken.Text = ""; // Get the search range. int from, to; if (!Int32.TryParse(txtFrom.Text, out from)) { MessageBox.Show("Invalid From value."); return; } if (!Int32.TryParse(txtTo.Text, out to)) { MessageBox.Show("Invalid To value."); return; } // Start the search for primes on another thread. CallAsyncWorkerDelegate doWork = new CallAsyncWorkerDelegate(CallAsyncWorker); doWork.BeginInvoke(from, to, null, null); }
private void cmdFind_Click(object sender, EventArgs e) { // Disable the button. cmdFind.Enabled = false; txtResults.Text = ""; lblTimeTaken.Text = ""; // Get the search range. int from, to; if (!Int32.TryParse(txtFrom.Text, out from)) { MessageBox.Show("Invalid From value."); return; } if (!Int32.TryParse(txtTo.Text, out to)) { MessageBox.Show("Invalid To value."); return; } // Start the search for primes on another thread. CallAsyncWorkerDelegate doWork = new CallAsyncWorkerDelegate(CallAsyncWorker); doWork.BeginInvoke(from, to, null, null); }