在Vs2005 DataGridView 中入一列属性为DataGridCombobox问题 我该怎么把DataSet中的数据绑定到DataGridView 中的ComboBox中的呢??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以在EditingControlShowing事件例如private void GridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e){ if (e.Control is DataGridViewComboBoxEditingControl) { if (this.GridView1.CurrentCellAddress.X == titleColumn.DisplayIndex) { comboTitle = e.Control as ComboBox; if(comboTitle != null) { comboTitle.DropDownStyle = ComboBoxStyle.DropDown; comboTitle.DataSource = MyDataSet.Tables[0]; comboTitle.SelectedIndexChanged -= new EventHandler(Combobox_SelectedIndexChanged); comboTitle.SelectedIndexChanged += new EventHandler(Combobox_SelectedIndexChanged); } } } 绑2次,第1次初始化ComboBox,形成你要的选择列,第2次直接绑你要现实的数据。 c# 用 win32 api treeview 遍历 让WCF控制SQL SERVER 负载均衡 请教一个聊天程序的问题 [求助]软件的操作日志记录 各位高手,前辈门好啊。我是C#初学者,刚弄完了毕业设计的程序。请大家有空的话帮忙测试一下了。 最后30分拿来再问个问题了。。。。。。Request.Form[item]如果ITEM是变量该怎么写?????? 在生成应用程序的时候把.net系统的dll也集成进去 急!急!急!急!两个小问题 【动态创建控件的问题】 c#中求余数的函数是什么? 用C#写的Winforms程序,如何生成单独的EXE文件 C#能不能动态声明数组?
例如
private void GridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (e.Control is DataGridViewComboBoxEditingControl)
{
if (this.GridView1.CurrentCellAddress.X == titleColumn.DisplayIndex)
{
comboTitle = e.Control as ComboBox;
if(comboTitle != null)
{
comboTitle.DropDownStyle = ComboBoxStyle.DropDown;
comboTitle.DataSource = MyDataSet.Tables[0];
comboTitle.SelectedIndexChanged -= new EventHandler(Combobox_SelectedIndexChanged);
comboTitle.SelectedIndexChanged += new EventHandler(Combobox_SelectedIndexChanged);
}
} }