c# comboBOX 的怪现象 你new两个ArrayList,一个comboBox分一个不就行了? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ArrayList al = new ArrayList(); ArrayList alb = new ArrayList(); al.Add("AAAA"); al.Add("BBBB"); alb = (ArrayList)al.Clone(); this.comboBox1.DataSource = al; this.comboBox2.DataSource = alb; panjf(Troj) 大概有20多个COMBOBOX,这样做合适吗? 这样啊,那你试下comboBox.Items.Add(list);如果不行,那样做就合适。 ArrayList al = new ArrayList(); al.Add("AAAA"); al.Add("BBBB"); this.comboBox1.DataSource = al; this.comboBox2.DataSource = al.Clone(); this.comboBox3.DataSource = al.Clone(); 每个ComboBox都绑定同一ArrayList的浅表副本即可 DropDownList1 .DataSource = list; DropDownList1.DataBind(); DropDownList2 .DataSource = list; DropDownList2.DataBind(); 谢谢大家,我是第一次做winform开发,没有经验!现在结贴!!谢谢!!!! 刚试了下,的确有这样的问题,jiatong1981的可行,可以取个巧在代码中全局替换 = list ;为= list.Clone(); 不用类型转换 lz:我想先问一个问题:你是做实验,还在做工程。如果是后者,有两种办法:1、你直接填充combobox.Items:你先把所有combox收集到一个集合类中,在进行填充。2、如果你的界面有这么多地方需要用combobox,那你这个界面设计是不友好的,用户要这么多地方用下拉框选择吗?你可以用ListView、DataGridView等控件集中显示。 请教各位前辈,如何提高自己对技术的理解能力 飞信二次开发和连接移动短信网关问题(在线等)? C# winfrom 中嵌入 word 提问:关于App.config文件的编码问题 .net项目在没有安装vs.net时使用什么调试工具呢? 如何在程序中选择打印纸类型? ?? 为何不能引用Microsoft.Office.Interop.Word名称空间? 怎么用C#实现webbrowser的IP代理?代理的IP怎么找? 超菜级问题......如何打包??? DateTime的问题? 关于ComboBox问题,急啊! 正则表达式取字符串的问题
ArrayList alb = new ArrayList();
al.Add("AAAA");
al.Add("BBBB");
alb = (ArrayList)al.Clone();
this.comboBox1.DataSource = al;
this.comboBox2.DataSource = alb;
如果不行,那样做就合适。
al.Add("AAAA");
al.Add("BBBB");
this.comboBox1.DataSource = al;
this.comboBox2.DataSource = al.Clone();
this.comboBox3.DataSource = al.Clone();
DropDownList1.DataBind();
DropDownList2 .DataSource = list;
DropDownList2.DataBind();
= list ;
为
= list.Clone();
不用类型转换
如果是后者,有两种办法:
1、你直接填充combobox.Items:你先把所有combox收集到一个集合类中,在进行填充。
2、如果你的界面有这么多地方需要用combobox,那你这个界面设计是不友好的,用户要这么多地方用下拉框选择吗?你可以用ListView、DataGridView等控件集中显示。