datagridview hidden cell inside tool tip

sharris_glascol
sharris_glascol used Ask the Experts™
on
When I hover over a cell can it display information from a hidden cell inside of the datagridview?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
yes, if you provide the text for the tooltip dynamically you could show any text you like. see the following sample code

Private cellColumnIndex As Integer = -1, cellRowIndex As Integer = -1
Private Sub testDataGridView_CellMouseMove(ByVal sender As Object, ByVal e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseMove
    If e.ColumnIndex <> Me.cellColumnIndex OrElse e.RowIndex <> Me.cellRowIndex Then
        Me.ToolTip2.Hide(Me.DataGridView1)
        Me.cellColumnIndex = e.ColumnIndex
        Me.cellRowIndex = e.RowIndex
        If Me.cellColumnIndex >= 0 AndAlso Me.cellRowIndex >= 0 Then
            Me.ToolTip2.SetToolTip(Me.DataGridView1, ConnectedUsers(Me.DataGridView1.Rows(e.RowIndex).Cells("Database").Value, Instance))
        End If
    End If
End Sub

Open in new window


here the SetToolTip could be used to determine which text to display.

Sara
Top Expert 2016

Commented:
There was no response to the given solution but it might have helped nevertheless and could help others who have the same issue.

Sara

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial