comboBox数据源 [英] comboBox datasource

查看:90
本文介绍了comboBox数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想从数据集向comboBox添加数据并执行此操作

方式:


public OpenDatabase(DataSet ds_db)

{

this.comboBox1 = new ComboBox();

this.comboBox1.DataSource = ds_db.Tables [0];

this.comboBox1.DisplayMember =" name";

InitializeComponent();


}


if我正在删除该行:this.comboBox1 = new ComboBox() - 我收到错误

,如果我离开它,组合框是空的。如何添加数据?

谢谢!


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ...获得奖励它!

Hello I want to add data to comboBox from a dataset and doing it this
way:

public OpenDatabase(DataSet ds_db)
{
this.comboBox1=new ComboBox();
this.comboBox1.DataSource=ds_db.Tables[0];
this.comboBox1.DisplayMember = "name";
InitializeComponent();

}

if I am erasing the line :this.comboBox1=new ComboBox()- I get an error
,if I leave it the combobox is empty . How to add the data to it?
Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

推荐答案

Juli,


可能是你已经设置了属性数据源的原因

它阻止将它加倍。 (也许在desinger中)


你可以将数据源设置为null。


Cor
Juli,

Probably is the reason that you have already set the property datasource and
it prevent to add it double. (maybe in the desinger)

You can set the datasource to null by the way.

Cor


Juli,


可能是你已经设置了属性数据源的原因和

它阻止将它添加一倍。 (也许在desinger中)


你可以将数据源设置为null。


Cor
Juli,

Probably is the reason that you have already set the property datasource and
it prevent to add it double. (maybe in the desinger)

You can set the datasource to null by the way.

Cor


你好,

我检查了它,在设计模式下没有价值

DataSource.Maybe还有一些东西可以防止

数据在组合框中显示?

谢谢!


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ...获得奖励!
Hello,
I checked it and in the design mode there is no value at
DataSource.Maybe there is something besides this that prevents from the
data to be shown in a comboBox?
Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于comboBox数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆