private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e) { connect = new CTUConnection(); try { if (string.IsNullOrEmpty(txt_CustCar.Text)) { MessageBox.Show("Please enter the name of the vehicle"); } else if (string.IsNullOrEmpty(txt_Prob.Text)) { MessageBox.Show("Please enter the problem of the vehicle"); } else { connect.GetCarServices(txt_CustCar.Text, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), txt_Prob.Text, int.Parse(cmbx_Mech.SelectedValue.ToString()), int.Parse(cmbx_Cust.SelectedValue.ToString())); } } catch (FormatException) { MessageBox.Show("Please select a date"); } catch (NullReferenceException) { MessageBox.Show("Please select a Mechanic"); } }