数据绑定难题~~~~在线急等啊 各位高手,哪位知道怎么把DS数据绑定到datagridview控件里的下拉框里啊!!!急啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 大致应该是这样吧....DropDownList1.DataSource = DS;DropDownList1.DataTextField = DS.Table[0].Colums[0]DropDownList1.DataValueField = DS.Table[0].Colums[1] DropDownList1.DataSource = DS;DropDownList1.DataTextField = "name"DropDownList1.DataValueField = "id" DropDownList1.DataSource = DS;DropDownList1.DataTextField = "name"DropDownList1.DataValueField = "id"--------------------------------------正解DataTextField和DataValueField 不能少 补充一下:DataTextField 是你绑定数据显示出来的字段,DataValueField 是显示出来字段的对应值,两者可以一样,可以不一样 source = new DataGridViewComboBoxColumn(); source.Name = "SourceField"; source.DataSource = _dsSource.Tables[0]; source.ValueMember = "name"; source.DisplayMember = "name"; grdView.Columns.Add(source); destination = new DataGridViewComboBoxColumn(); destination.DataSource = _dsDest.Tables[0]; destination.Name = "Destination"; destination.ValueMember = "name"; destination.DisplayMember = "name"; grdView.Columns.Add(destination); RequiredFieldValidator的应用 Windows7下开发Winform程序,运行在其它Windows7或XP上界面发生变化。急!!! 哭求关于gridview的问题 委托说明及异步的方式调用和线程关系问题...求助......... 哪位有MS Project 的工具栏图标,可以提供一下 ,100分成交 水晶报表如何做:只要第一页不要页眉? 引用外部组件出错,已经全部引用该引用的了。 请高人指点关于MemoryStream和gzip的问题 想学c# 求推荐学习资料, 一个自制控件比较麻烦的问题。 SqlDbType.Decimal如何加精度啊 怎么反查所属名字空间
DropDownList1.DataSource = DS;
DropDownList1.DataTextField = DS.Table[0].Colums[0]
DropDownList1.DataValueField = DS.Table[0].Colums[1]
DropDownList1.DataTextField = "name"
DropDownList1.DataValueField = "id"
DropDownList1.DataTextField = "name"
DropDownList1.DataValueField = "id"--------------------------------------
正解
DataTextField和DataValueField 不能少
source.Name = "SourceField";
source.DataSource = _dsSource.Tables[0];
source.ValueMember = "name";
source.DisplayMember = "name";
grdView.Columns.Add(source); destination = new DataGridViewComboBoxColumn();
destination.DataSource = _dsDest.Tables[0];
destination.Name = "Destination";
destination.ValueMember = "name";
destination.DisplayMember = "name";
grdView.Columns.Add(destination);