代码改变世界

向Combox控件中添加数据

2012-08-08 15:15  追梦网络  阅读(838)  评论(0编辑  收藏  举报

            List<KeyValuePair<object, string>> dit = new List<KeyValuePair<object, string>>();
            dit.Add(new KeyValuePair<object, string>(1, "测试操作类型"));
            dit.Add(new KeyValuePair<object, string>(2, "操作类型"));
           
            this.cbxMethod.DataSource = dit;
            this.cbxMethod.DisplayMember = "Value";
            this.cbxMethod.ValueMember = "Key";