//What happens when the Run button is clicked private void Search_For_Button_Click(object sender, RoutedEventArgs e) { //Check content if it only has A,U,G,C in it String s = Search_Box.Text.ToUpper(); Boolean b = true; foreach (char c in s) { if (!c.Equals('A') && !c.Equals('U') && !c.Equals('G') && !c.Equals('C')) { b = false; } } // if (b && s.Length >= minLength && s.Length <= maxLength) { //Send s to mainWindow mainWindow.SetSearchString(s); this.Close(); } else if (s.Length > maxLength) { MessageBox.Show("Error, length cannot be greater than " + maxLength, "Length Error"); } else if (s.Length < minLength) { MessageBox.Show("Error, length cannot be less than " + minLength, "Length Error"); } else { MessageBox.Show("Error, text must contain only A, U, G, and C", "Sequence Error"); } }