public static void BindComboBoxAddAll(string strSql, ComboBox cbb) { List <ComboBoxItem> itemList = Common_Func.GetComboBoxItem(strSql); List <ComboBoxItem> itemAll = new List <ComboBoxItem>(); ComboBoxItem item = new ComboBoxItem(); item.ID = 0; item.Name = "所有"; itemAll.Add(item); foreach (ComboBoxItem item1 in itemList) { itemAll.Add(item1); } cbb.DataSource = itemAll; cbb.DisplayMember = "Name"; cbb.ValueMember = "ID"; }
public static void BindComboBox(string strSql, ComboBox cbb) { cbb.DataSource = Common_Func.GetComboBoxItem(strSql); cbb.DisplayMember = "Name"; cbb.ValueMember = "ID"; }