1
嗨程序員, 其實我在DataGridvIew DataGridViewComboBoxCell,我需要更改DataGridViewComboBox值,如果條件爲真時CellContentClick事件被觸發。 我的代碼是這樣的:如何在CellContentClick事件中手動選擇DataGridviewComboBoxCell值?
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到組合框提示錯誤。
請幫我一把。