如何在运行时在只读datagridviewcell中添加值 [英] how to add a value at runtime in a read only datagridviewcell
本文介绍了如何在运行时在只读datagridviewcell中添加值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我的Datagridview是一个数据绑定.
我的命令如下
将myCell设为DataGridViewCell
myCell = grid.CurrentCell
grid.Item(2,myCell.RowIndex).ReadOnly = False
grid.Item(2,myCell.RowIndex).Value ="hello"
grid.Item(2,myCell.RowIndex).ReadOnly = True
在现有行中运行时发生datagriderror并取消编辑,但在newrow中它正在工作.
解决方案
您需要更新数据源并重新绑定,我不认为您可以在数据绑定控件中编辑数据.
Hi
My Datagridview is a databounded.
my command below
Dim myCell As DataGridViewCell
myCell = grid.CurrentCell
grid.Item(2, myCell.RowIndex).ReadOnly = False
grid.Item(2, myCell.RowIndex).Value = "hello"
grid.Item(2, myCell.RowIndex).ReadOnly = True
while running in a existing row datagriderror occuring and cancelling the edit, but in a newrow it is working.
can help?
解决方案
You need to update your data source and rebind, I don''t believe you can edit the data in a data bound control.
这篇关于如何在运行时在只读datagridviewcell中添加值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文