标签:data value dex length ++ void select string box
/// <summary> /// 绑定combox 按顺序填写value、member 示例:InitCombox.BindCombox(cbxStatus,"1","启用","0","禁用"); /// </summary> /// <param name="box"></param> /// <param name="valueMember"></param> public static void BindCombox(ComboBox box, params string[] valueMember) { List<ComboxItem> items = new List<ComboxItem>(); for (int i = 0; i < valueMember.Length / 2; i++) { int j = i * 2; items.Add(new ComboxItem { ValueMember = valueMember[j], DisplayMember = valueMember[j + 1] }); } box.DataSource = items; box.DisplayMember = "DisplayMember"; box.ValueMember = "ValueMember"; box.SelectedIndex = -1; }
标签:data value dex length ++ void select string box
原文地址:https://www.cnblogs.com/x666066/p/11468676.html