当前位置: 代码迷 >> C# >> datagridview 快速输入,复制的有关问题
  详细解决方案

datagridview 快速输入,复制的有关问题

热度:4817   发布时间:2013-02-25 00:00:00.0
datagridview 快速输入,复制的问题。
本帖最后由 oh_ku 于 2013-01-31 17:00:33 编辑
自己写的方法。


鞋厂输入名字,下面就会出现选择的,
但是第一次选中下面红色框框后,文本框输入的值还是我输入的“g”

但是第二次重新选择下,别的鞋厂,就可以正常复制了,请问这个是什么问题



 
private void kdgvAllShoes_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
dgvShoesRegion[curColumnIndex, curRowIndex].Value = dgvTmp.CurrentRow.Cells["名字"].Value;

dgvShoesRegion[curColumnIndex - 1, curRowIndex].Value = dgvTmp.CurrentRow.Cells["编码"].Value;

MessageBox.Show(dgvTmp.CurrentRow.Cells["编码"].Value + "|" + dgvTmp.CurrentRow.Cells["名字"].Value);    

dgvTmp.Visible = false;

dgvShoesRegion.EndEdit();

MessageBox.Show(dgvShoesRegion.CurrentRow.Cells["shoesname"].Value.ToString());
}

------解决方案--------------------------------------------------------
在赋值前面加上
dgvShoesRegion.CommitEdit(DataGridViewDataErrorContexts.Commit);
  相关解决方案