I have a winform datagridview which contains a column of buttons. I'd like to disable tooltips for that column only -- tooltips should still show up for other columns. I find tooltips get in the way of clicking the button -- when one clicks on the tooltip, the click event doesn't percolate down to the button. Very annoying.
I've tried handling the CellTooltipNeeded event and return null or empty string for that column, but then the tooltip just reverts to showing the button text in the tooltip. I've also tried setting the Column.ToolTipText to empty string, and that correctly hides the column header's tooltip, but all the other rows' tooltip still shows up.
What's the best way to disable tooltips for an entire column?
Thanks Jimmy
I was looking for an answer to this question but all forums stated it was not possible. However, I did find a solution.
On your DataGridView, handle the CellMouseEnter event. In the event handler the DataGridViewCellEventArgs contains a ColumnIndex property. Use that to set the DataGridView.ShowCellToolTips property. Like this (Excuse the VB please):
Private Sub MyDataGridView_CellMouseEnter(sender As Object, e as DataGridViewCellEventArgs) Handles DataGridView.CellMouseEnter
MyDataGridView.ShowCellToolTips = e.ColumnIndex = <the Column # I want to show Tooltips>
End Sub
And, obviously, it's very straightforward to turn this on or off at the cell level too since DataGridViewCellEventArgs also contains a RowIndex property.
I'm only sorry I discovered an answer five years after this was posted!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With