读书人

dataGridView 有关问题

发布时间: 2012-04-01 17:23:46 作者: rapoo

dataGridView 问题
我的DataGridViewCheckBoxColumn为什么总选择不了用这个
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

if (e.ColumnIndex == 0)
{
dataGridView1.Rows[e.RowIndex].Cells[0].Value = (bool)dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue;

}
}
dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue;这个总是返回false


[解决办法]
这样设置就可选中:
this.dataGridView1.Rows[e.RowIndex].Cells[0].Value = "true ";

读书人网 >C#

热点推荐