我在Visual Basic中开发简单的应用程序,我想要做的是:
加载整个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
但它甚至没有反应。 (function被触发但代码不工作)
最后一步是将编辑后的只读设置回该单元格
我只是做了:
Private Sub CellDouble(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) _ Handles DataGridView1.CellDoubleClick DataGridView1.BeginEdit() End Sub
它工作正常…