private void Search_Click(object sender, EventArgs e) { int m; if (Words == null || !Int32.TryParse(max.Text, out m)) { return; } String a = Pattern.Text; WordList.Items.Clear(); WordList.BeginUpdate(); foreach (String x in Words) { if (checkBox1.Checked == true) { if ((Levenstein.Distance(x, Pattern.Text)) <= m) { WordList.Items.Add(x); } } if (checkBox1.Checked == false) { if ((Levenstein.Distance(x, Pattern.Text)) <= m) { WordList.Items.Add(x); } } } WordList.EndUpdate(); }