我想只允许编辑DataGridView中的一列,但我想让用户双击该行中的任何项目,当CellBeginEdit触发时,强制编辑我的科拉姆。我开始这样做:在DataGridView上强制编辑为一列
Private Sub dgvCaptions_CellBeginEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles dgvCaptions.CellBeginEdit
If e.ColumnIndex <> COL_CAPTION Then
e.Cancel = True
dgvCaptions.ClearSelection()
dgvCaptions.Rows(e.RowIndex).Cells(COL_CAPTION).Selected = True
dgvCaptions.BeginEdit(False)
End If
End Sub
但因为这会引发错误的BeginEdit(假)线“操作是无效的,因为它会导致重入调用BeginEdit功能。”这当然会做,但这是我想要的。有没有另一种方法来做到这一点?
我不只是想双击编辑,我希望用户按下F2或双击该行中的任何项目,这将允许他们只编辑该行中的一列 – 2010-12-17 11:32:54