如何根据DataGridViewComboxColum选择的索引更改DataGridView中特定列的值?

问题描述 投票:0回答:1

我的Windows窗体应用程序上有一个名为“cbxActionType”的DataGridViewComboxColum,它的项集合中包含以下值。 •有关信息•用于注释•用于查看...等.DataGridView1有一个名为“NDays”的列,用于存储天数。如果将“cbxActionType”选择的值更改为“For Information”,如何将NDays列值设置为0(零天)?

DataGridview Combobox Column

datagridview selectedindexchanged datagridviewcombobox
1个回答
0
投票
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
    if (dataGridView1.CurrentRow.Cells["cbxActionType"].Value == "For Information")
    {
        dataGridView1.CurrentRow.Cells["NDays"].Value = 0;               
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.