private void Loading_Form() { foodBO bo = new foodBO(); DataSet result = bo.getAllCategory(); if (result.Tables[0].Rows.Count > 0 && result.Tables.Count > 0) { for (int i = 0; i < result.Tables[0].Rows.Count; i++) { //cb_CategoryName.Items.Add(result.Tables[0].Rows[i][1].ToString()); Category.Add(new categoryDTO { categoryId = result.Tables[0].Rows[i][0].ToString(), categoryName = result.Tables[0].Rows[i][1].ToString() }); cb_CategoryName.Items.Add(Category[i].categoryName); } } }
private void loadingFood() { foodBO bo = new foodBO(); DataSet result = bo.getAllCategory(); for (int i = 0; i < result.Tables[0].Rows.Count; i++) { Category.Add(new categoryDTO { categoryId = result.Tables[0].Rows[i][0].ToString(), categoryName = result.Tables[0].Rows[i][1].ToString() }); cb_CategoryName.Items.Add(Category[i].categoryName); } txt_FoodId.Text = Food_Form.foodId; txt_FoodName.Text = Food_Form.foodName; cb_CategoryName.Text = Food_Form.categoryName; System.Byte[] arr = Food_Form.foodPicture; MemoryStream stream = new MemoryStream(arr); Image img = Image.FromStream(stream); pb_FoodPicture.Image = img; }