本文介绍了操作未成功,因为程序无法提交或退出单元格值更改。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
操作未成功,因为程序无法提交或退出单元格值更改。
datdgridview中出现此错误
如何解决
请紧急
Operation did not succeed because the program cannot commit or quit a cell value change.
this error arises in datdgridview
how it is solved
pls its urgent
private void dataGridView1_KeyUp(object sender, KeyEventArgs e)
{
try
{
dataGridView1.Refresh();
Console.WriteLine( dataGridView1.Rows.Count);
int Secondrowindex = Convert.ToInt32(dataGridView1.CurrentRow.Index);
int rowcounter = dataGridView1.Rows.Count;
int asd = Convert.ToInt32(dataGridView1.CurrentCell.ColumnIndex);
if (asd <= 3 && Secondrowindex == rowcounter - 1)
{
if (e.KeyCode == Keys.Enter)
{
if (asd == 3)
{
dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex - 2, dataGridView1.CurrentRow.Index];
}
else if (asd == null)
{
}
else
{
dataGridView1.EndEdit();
string asew = dataGridView1.EditMode.ToString();
dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex + 1, dataGridView1.CurrentRow.Index];
}
}
}
else if (asd == 3 && rowcounter == Secondrowindex + 1)
{
if (e.KeyCode == Keys.Enter)
{
dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex + 1];
}
}
else
{
}
}
catch (Exception gf)
{
MessageBox.Show(gf.Message);
}
}
此处异常来自
here exception comes
推荐答案
dgv.CurrentCell = dgv[0, 0];
我解决了这个问题。
That solved this problem for me.
这篇关于操作未成功,因为程序无法提交或退出单元格值更改。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!