private void ComputeAllBtn_Click(object sender, EventArgs e) { if (QuestionNumber == "3") { ApplyEuclidAlg(); } else { ApplyExtendedEuclidAlg(); } // if list is empty. weird construct, but there is no IsEmpty() method for a list if (!PairList.Any()) { MessageBox.Show("List is empty."); } else { MessageBox.Show("Done!..."); this.Close(); } }