[RESOLVED] [2005] Making the cells in a DGV unselectable
I am using a DGV to display data from a table but I've been unable to figure out how to prevent the user from clicking on a cell and selecting it. I'd use DataGridView.Enabled = False if it also didn't prevent the use of the scroll bar.
I also checked out the DataGridView.SetStyle(Selectable, False) member but that is protected so I can't touch it. Does anyone have any suggestions?
I've disabled all editing abilities (adding, deleting, reordering, etc) for it. It has to be something trivial I am completely missing and I fear a serious "DOH!" moment as soon as the solution is posted.
Gr,
Mightor
Re: [2005] Making the cells in a DGV unselectable
Re: [2005] Making the cells in a DGV unselectable
Quote:
Originally Posted by stimbo
ReadOnly = True ??
I can still select the cells and rows with that set to True.
Gr,
Mightor
Re: [2005] Making the cells in a DGV unselectable
This did the trick for me:
vb Code:
Private Sub DataGridView3_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView3.SelectionChanged
DataGridView3.CurrentCell.Selected = False
End Sub
Works a treat.
Gr,
Mightor