在Vs2005 DataGridView 中入一列属性为DataGridCombobox问题
我该怎么把DataSet中的数据绑定到DataGridView 中的ComboBox中的呢???
------解决方案--------------------可以在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);
}
}
}