Prevent click on datagrid with setting Enable = false
-
Hi all, Another question for all you DataGrid gurus out there... I have a read only datagrid which (for reasons that are unimportant here) my users want to totally ignore any mouse clicks. However, the grid will always need to be scrolled so I can't simply set the grid 'Enabled' property to False. What I really want is something like what you can do with the KeyPress/KeyDown events where you can say '.Handled = true' and the event will simply ignore that key... how can I do the same *just* for my datagrid but for mouse clicks? TIA once again for any help. Mike
-
Hi all, Another question for all you DataGrid gurus out there... I have a read only datagrid which (for reasons that are unimportant here) my users want to totally ignore any mouse clicks. However, the grid will always need to be scrolled so I can't simply set the grid 'Enabled' property to False. What I really want is something like what you can do with the KeyPress/KeyDown events where you can say '.Handled = true' and the event will simply ignore that key... how can I do the same *just* for my datagrid but for mouse clicks? TIA once again for any help. Mike
What specifically is it you want to ignore? Column sorting? If so, set AllowSorting to False. Colors changing when a row is clicked? If so, set the SelectionBackColor to be the same as BackgroundColor. You would also probably want to set RowHeadersVisible to False and ReadOnly to True. Is there something beyond this? Dean
-
What specifically is it you want to ignore? Column sorting? If so, set AllowSorting to False. Colors changing when a row is clicked? If so, set the SelectionBackColor to be the same as BackgroundColor. You would also probably want to set RowHeadersVisible to False and ReadOnly to True. Is there something beyond this? Dean
Thanks Dean... the issue we're having is even when the datagrid is readonly the user can still click on the grid and the selected cell changes colours as if it is going to allow the user to edit it... I'll try the SelectionBackColor and see how that goes. Even so I do wish there was a way to ignore (or turn off) a certain event for any control like the handled property of KeyDown does. Mike