嗨程序员,实际上我在 DataGridvIew 中有一个 DataGridViewComboBoxCell,如果在触发 CellContentClick 事件时条件为真,我需要更改 DataGridViewComboBox 值。我的代码是这样的:
private void gridviewholiday_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
{
int row = e.RowIndex;
int colo = e.ColumnIndex;
/*=============== To Show The Details =====================*/
if (e.ColumnIndex == 4)
{
if (Convert.ToBoolean(gridviewholiday.Rows[e.RowIndex].Cells[0].Value))
{
if (Type == "CUS")
{
Type = test.colType;
if (Type == "NO")
{
ComboBox combo = (ComboBox)sender;
combo.SelectedIndex = 0;
}
}
}
但是在将 DataGridView 转换为 Combobox 时会出错。
请帮帮我。