Disabling tooltip for certain cells

c#, datagridview, tooltip, winforms

Solution

Unfortunately, the `DataGridView` control does not support this. Its ShowCellToolTips property can only be used to disable tooltips globally. The cases where a tooltip is displayed are documented as:

The value of the `DataSource` property is not `null` or the value of the `VirtualMode` property is `true`, and a handler for the `CellToolTipTextNeeded` event sets the `DataGridViewCellToolTipTextNeededEventArgs.ToolTipText` property to a value other than `String.Empty`.

The `ToolTipText` property of the cell has a value other than `String.Empty`. Setting this property has no effect when there is a `CellToolTipTextNeeded` event handler because getting the value of the property automatically raises the event and returns the ToolTip text specified in the event handler.

The cell value is truncated in the cell display. When the value of the cell `ToolTipText` property value is `String.Empty`, the full value of the truncated cell value is displayed in the ToolTip.

As you can see, there is no way to avoid the third case: If `ShowCellToolTips` is `true` and the value of a cell is truncated, a tooltip containing the full value will be displayed.

Problem

I have one gridview in my windows form. Now i'm showing custom tooltip using the following code, ``` private void Audit_Dg_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 7 || e.ColumnIndex == 8 || e.ColumnIndex == 10 || e.ColumnIndex == 11 && e.RowIndex >= 0) { DataGridViewCell cell = this.Audit_Dg.Rows[e.RowIndex].Cells[e.ColumnIndex]; cell.ToolTipText = "Click Here To View The Message"; } } ``` it showing my message for those cells satisfying my condition and the cell content for all those doesn't satisfying my condition. is there any way to remove that tool-tips from my grid-view and show only my custom tool-tip? if there any way,please help me...

Original source