【求助】关于DataGridView的一段代码问题。。。
![](zzz/editor/img/code.gif)
if (dgvQuestionList.SelectedRows[0].Cells["Question"].Value.ToString() == "") { MessageBox.Show("题目不能为空","提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (dgvQuestionList.SelectedRows[0].Cells["OptionA"].Value.ToString() == "" || dgvQuestionList.SelectedRows[0].Cells["OptionB"].Value.ToString() == "" || dgvQuestionList.SelectedRows[0].Cells["OptionC"].Value.ToString() == "" || dgvQuestionList.SelectedRows[0].Cells["OptionD"].Value.ToString() == "") { MessageBox.Show("选项不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (dgvQuestionList.SelectedRows[0].Cells["Answer"].Value.ToString() == "") { MessageBox.Show("答案不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (dgvQuestionList.SelectedRows[0].Cells["Difficulty"].Value.ToString() == "") { MessageBox.Show("难度不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
想实现对DataGridView中数据的修改,但我想先进行修改的非空判断,就凭感觉
![](images/smilies/emot/em09.gif)
ex是:{"索引超出范围。必须为非负值并小于集合大小。\r\n参数名: index"}
这个是什么意思呢??
![](images/smilies/emot/em13.gif)
![](images/smilies/emot/em03.gif)
怎么修改呀。。。
望指教!