private void LoadFoodCategories() { var listCategory = foodCategory.GetFoodCategories(); cbCategory.DataSource = listCategory; cbCategory.DisplayMember = "nameFoodCategory"; }
//List Category private void ListCategory() { var list = category.GetFoodCategories(true); foreach (var item in list) { ListViewItem x = new ListViewItem(item.idFoodCategory.ToString()); x.SubItems.Add(item.nameFoodCategory); lsvCategory.Items.Add(x); } }
private void LoadCategory() { var listCate = category.GetFoodCategories(); cbFoodCategory.Items.Clear(); foreach (var item in listCate) { cbFoodCategory.Items.Add(item.nameFoodCategory); } cbFoodCategory.SelectedIndex = 0; }
public fEditFood(string id, string name, string price, string idCategory, fAdmin fAdmin) { InitializeComponent(); this.fadmin = fAdmin; this.id = id; this.name = name; this.price = price; this.idCategory = idCategory; txbnameFood.Text = name; txbprice.Text = price; var listCategory = category.GetFoodCategories(); List <string> listName = new List <string>(); foreach (var item in listCategory) { listName.Add(item.nameFoodCategory); } string nameCategory = category.GetNameCategoryById(int.Parse(idCategory)); cbCategory.DataSource = listName; cbCategory.SelectedItem = nameCategory; }