private void bAddFoodItem_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; string fName = ""; double fPrice; string fDesc = ""; string fImg = ""; Main_Category fMain = Main_Category.All; Sub_Category fSub; try { if ((fName = tbAddName.Text) == "") { throw new ArgumentNullException("Missing Name"); } if (tbAddPrice.Text == "") { throw new ArgumentNullException("Missing Price"); } fPrice = double.Parse(tbAddPrice.Text); fDesc = tbAddDesc.Text; fImg = TelemealPath(tbAddImage.Text); if (cbAddCategory.Text == "") { throw new ArgumentNullException("Missing Category"); } fSub = (Sub_Category)Enum.Parse(typeof(Sub_Category), cbAddCategory.Text); Food food = new Food { Name = fName, Price = fPrice, Description = fDesc, Img = fImg, MainCtgr = fMain, SubCtgr = fSub }; conn.InsertFood(food); lFood.Add(food); tbAddName.Clear(); tbAddImage.Clear(); tbAddDesc.Clear(); tbAddPrice.Clear(); cbAddCategory.SelectedIndex = -1; cbEditName.Items.Add(food.Name); } catch (ArgumentNullException ex) { MessageBox.Show(ERROR_CODE_MRF + ex.ParamName); } catch (FormatException ex) { MessageBox.Show(ERROR_CODE_IDT); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }