110,536
社区成员
发帖
与我相关
我的任务
分享
//模拟判断结果的变量
bool judgeResult=true;
public Form1()
{
InitializeComponent();
dgv.Rows[0].Cells[0].Value = 1;
dgv.Rows[0].Cells[1].Value = "Kensou";
//接下来清空第一行第一个单元格的内容,即1
if(judgeResult)
dgv.Rows[0].Cells[0].Value = null;
}
dataGridView1.Rows[2].Cells["列名"].Value = String.Empty;
MessageBox.Show("您输入的格式有误!");
dataGridView1.CurrentRow.Cells["GoodsNum"].Value = "";
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if ("验证有误")
this.dataGridView1[e.ColumnIndex, e.RowIndex].Value = null;
}