我的期望:Is Wash
和Is Return
是ComboBox
列;當我點擊Is Wash
時,我打算將Is Return
更改爲true
。調用CellContentClicked事件時DataGridView值不會更改
這是我DataGridView
:
我試圖用CellContentClick
和CellClick
下面是我的函數:
private void dtGridViewLoan_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
if (dtGridViewLoan.SelectedRows[0].Cells["is_wash"].Value != DBNull.Value)
if (Convert.ToBoolean(dtGridViewLoan.Rows[e.RowIndex].Cells["is_wash"].Value))
{
dtGridViewLoan.Rows[e.RowIndex].Cells["is_return"].Value = true;
}
}
最後,不管我怎麼改變ComboBox
值,數據本身保持返回false
,即使它是true
。請幫忙。
問題並不清楚請詳細說明你想要什麼 – Lijo
另一個[選項](http://stackoverflow.com/a/29418616/3773066)TaW的答案(它已經非常有效)。 – OhBeWise