private void saveButton_Click(object sender, EventArgs e) { Meal aMeal = new Meal(); aMeal.MemberId = (int)nameComboBox.SelectedValue; aMeal.Date = Convert.ToDateTime(mealDateTimePicker.Text); try { aMeal.TotalMeal = Convert.ToDouble(totalMealTextBox.Text); } catch (Exception) { MessageBox.Show("Please input correct"); return; } if (aMeal.MemberId == -1) { MessageBox.Show("Please Select Name"); return; } string message = aMealManager.SaveMeal(aMeal); MessageBox.Show(message); }