---------------------------
A 值(1,2,3)
---------------------------
B 值(3,4,5)
---------------------------
C 值(6,7,8)
在DataGridView中每行的DataGridViewComboBoxColumn的值都是不一样的
各位大虾有没有什么方法?
9 个解决方案
#1
你把你代码贴出来看看
#2
你数据从何而来呢,完全可以手动添加的
#3
没明白你的意思,贴代码
#4
private void dgvOrder_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 9)
{
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
myFunction.dataGridViewComboBoxColumn(cbcWorkstageId, myItemNumber);
}
}
}
#5
数据从数据库内取
#6
private void dgvOrder_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 9)
{
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
myFunction.dataGridViewComboBoxColumn(cbcWorkstageId, myItemNumber);
}
}
}
#7
private void grvSKU_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (grvSKU.CurrentCell.ColumnIndex == 2)
{
ComboBox cb = e.Control as ComboBox;
if (cb != null)
{
//判断内容,绑定相应的数据源
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
cb.DataSource = Brand.GetBrands();
}
else
{
cb.DataSource = Season.GetSeasons();
}
}
}
}
改个事件试试
{
if (grvSKU.CurrentCell.ColumnIndex == 2)
{
ComboBox cb = e.Control as ComboBox;
if (cb != null)
{
//判断内容,绑定相应的数据源
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
cb.DataSource = Brand.GetBrands();
}
else
{
cb.DataSource = Season.GetSeasons();
}
}
}
}
改个事件试试
#8
DataGridView 中发生以下异常
System.ArgumentException: DataGridViewComboBoxCell 值无效
要替换此默认对话框,请处理 DataError事件
#9
DataGridView 不支持这样做。改为双击单元格弹出另外窗体来实现。
#1
你把你代码贴出来看看
#2
你数据从何而来呢,完全可以手动添加的
#3
没明白你的意思,贴代码
#4
private void dgvOrder_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 9)
{
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
myFunction.dataGridViewComboBoxColumn(cbcWorkstageId, myItemNumber);
}
}
}
#5
数据从数据库内取
#6
private void dgvOrder_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 9)
{
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
myFunction.dataGridViewComboBoxColumn(cbcWorkstageId, myItemNumber);
}
}
}
#7
private void grvSKU_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (grvSKU.CurrentCell.ColumnIndex == 2)
{
ComboBox cb = e.Control as ComboBox;
if (cb != null)
{
//判断内容,绑定相应的数据源
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
cb.DataSource = Brand.GetBrands();
}
else
{
cb.DataSource = Season.GetSeasons();
}
}
}
}
改个事件试试
{
if (grvSKU.CurrentCell.ColumnIndex == 2)
{
ComboBox cb = e.Control as ComboBox;
if (cb != null)
{
//判断内容,绑定相应的数据源
string myItemNumber = dgvOrder[2, e.RowIndex].Value.ToString();
if (myItemNumber != null)
{
cb.DataSource = Brand.GetBrands();
}
else
{
cb.DataSource = Season.GetSeasons();
}
}
}
}
改个事件试试
#8
DataGridView 中发生以下异常
System.ArgumentException: DataGridViewComboBoxCell 值无效
要替换此默认对话框,请处理 DataError事件
#9
DataGridView 不支持这样做。改为双击单元格弹出另外窗体来实现。