private void addMed_Click(object sender, EventArgs e) { int treatTimeMin; if ((string.IsNullOrWhiteSpace(medNameInput.Text) == false) && (string.IsNullOrWhiteSpace(medDoesInput.Text) == false) && (Int32.TryParse(treatTimeInput.Text, out treatTimeMin))) { Int32.TryParse(treatTimeInput.Text, out treatTimeMin); TimeSpan temp = new TimeSpan(0, treatTimeMin, 0); meds.addMed(medNameInput.Text, medDoesInput.Text, temp); MessageBox.Show("Medication Added"); currentTimers.Clear(); medNode[] currentMeds = meds.getMedArray(); foreach (medNode x in currentMeds) { currentTimers.AppendText(x.toString(1) + "\r\n"); } } else { MessageBox.Show("Please enter all information in a valid format before trying to enter medication"); } medNameInput.Clear(); medDoesInput.Clear(); treatTimeInput.Clear(); }