我正在开发visual basic中的简单app,我想做的是:
加载整个DataGridView1
为ReadOnly
接下来,如果用户双击单元格,则会转换该单元格的编辑模式 我试着这样做:
Private Sub CellDouble(ByVal sender As Object,
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellDoubleClick
DataGridView1(e.ColumnIndex, e.RowIndex).ReadOnly = False
DataGridView1.BeginEdit(e.RowIndex)
End Sub
但它甚至没有反应。 (触发功能但代码不起作用)
最后一步是在编辑后将只读设置回该单元格
答案 0 :(得分:1)
我只是这样做了:
Private Sub CellDouble(ByVal sender As Object,
ByVal e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellDoubleClick
DataGridView1.BeginEdit()
End Sub
它工作得很好......