1

如何在c#net中的datagridview中启用/禁用更改单元格值的按钮在datagridview的哪个事件上,我应该编写我的代码?

提前致谢, 斯瓦纳

4

2 回答 2

1

试试这样:

private void DataGridView1_CellValueChanged(object sender, 
                                            DataGridViewCellEventArgs e)
{
    // enable/disable a button
}
于 2012-09-06T05:58:42.313 回答
0
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e){
  if(dataGridView1.Columns[e.ColumnIndex].Name == "YourColumnName"){
    // enable/disable a button
  }
}

或者

private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e){
  if(dataGridView1.Columns[e.ColumnIndex].Name == "YourColumnName"){
    // enable/disable a button
  }
}
于 2015-07-21T11:54:15.053 回答