private void button1_Click(object sender, EventArgs e) { int studentID; try { studentID = int.Parse(AddReferral_ID.Text); } catch { MessageBox.Show("Please make sure a number is in the ID field!"); return; } string ID = studentID + ""; string Type = AddReferral_Category.Text; DateTime date = DateTime.Now; string year = date.Year.ToString(); string month = date.Month.ToString(); string day = date.Day.ToString(); string curDay = year + '-' + month + '-' + day; string Desc = RefDesc.Text; if (Desc == "") { Desc = "[Description Missing]"; } if (Model.InsertReferral(ID, curDay, Type, Desc)) { this.Close(); } else { MessageBox.Show("Something went wrong in processing the Referral. Please try again."); } }