C#中DataGridView的单元格操作。
[此问题的推荐答案]
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0) //这里改成Present列所在列号
{
DataGridViewCell Cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];//得到点击单元格
bool editValue = Convert.ToBoolean(Cell.EditedFormattedValue);//得到复选框中的值
if (editValue) //复选框是选中的状态
{
//操作Times列的值
}
本贴来自ZDNetChina中文社区 http://bbs.zdnet.com.cn ,本贴地址:http://bbs.zdnet.com.cn/viewthread.php?tid=365977