private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e) { connect = new CTUConnection(); try { if (string.IsNullOrEmpty(txt_Brand.Text)) { MessageBox.Show("Please enter the name of the motocycle"); } else if (string.IsNullOrEmpty(txt_Color.Text)) { MessageBox.Show("Please enter the color of the motocycle"); } else if (string.IsNullOrEmpty(txt_Model.Text)) { MessageBox.Show("Please enter the model of the motocycle"); } else if (string.IsNullOrEmpty(txt_Price.Text)) { MessageBox.Show("Please enter the price of the motocycle"); } else { connect.GetMoto(txt_Brand.Text, txt_Model.Text, txt_Color.Text, txt_Price.Text, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), data2); } } catch (FormatException) { MessageBox.Show("Please select a date"); } catch (Exception) { } }