我有一个方法,更新包含类型DataGridViewComboBoxCell的列,早期ComboBoxCell为空,选择产品和ComboBoxCell更新时添加新记录做得很好,但当我修改它发送异常: “ DataGridViewComboBoxCell值无效“ 如果您在重新分配DataSource属性时不适用。“DataGridViewComboBoxCell值无效”。属性DataSource
这里的方法:
private void CargarTipoGasto(ref DataGridViewComboBoxCell ComboColumn)
{
ComboColumn.DataSource = from oPro in dtContext.tblProducto
where oPro.ProductoId == objProducto.ProductoId
from oMat in dtContext.tblMatrizDeCuentasGD
where oMat.Partida.Substring(0,3) ==
oPro.tblObjetoGasto.ObjetoGastoId.Substring(0,3)
from oTipGas in dtContext.tblTipoGasto
where oMat.TipoGasto == oTipGas.TipoGastoId
select oTipGas;
ComboColumn.ValueMember = TIPOGASTO_ID;
ComboColumn.DisplayMember = TIPOGASTO_VALOR;
}
verique没有空值,该引用以及
非常感谢你的帮助