How to kow the Lenght of the Text in the Current DataGridTextBoxColumn (on MouseMove)

  • Thread starter Thread starter DraguVaso
  • Start date Start date
D

DraguVaso

Hi,

I need to know the Lenght of the Text in a DataGridTextBoxColumn when I move
with the mouse over it, and show it in a ToolTip.
I have something that works, but it works only when the DataGridextBoxColumn
is not selected. Once I select it (type some additional text in it), I don't
see the ToolTip anymore...

I gues that's because it isn't anymore the DataGrid that the Mouse is moving
over, but the Cell. Does anybody knows a solution for this?

Thanks a lot in advance,

Pieter


You can see my DataGrid_MouseMove here:

Private Sub dbgGrid_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles dbgGrid.MouseMove
Dim p1 As New Point

p1 = dbgGrid.PointToClient(Cursor.Position)

Dim intCol As Integer = dbgGrid.HitTest(p1).Column
Dim intRow As Integer = dbgGrid.HitTest(p1).Row

If (intCol = 3) And (intRow > -1) Then
Dim strT As String
Try
strT = dbgGrid.Item(intRow, intCol).ToString
Catch ex As Exception
strT = ""
End Try

strT = strT & vbCrLf & "Length: " & strT.Length

totImport.SetToolTip(dbgGrid, strT)
totImport.Active = True
Else
totImport.SetToolTip(dbgGrid, "")
totImport.Active = False
End If
End Sub
 
Hm ok, I found it myself.. :-)

Just adding a Handler to the MouseMove-event of the
TableStyle.GridcolumnStyels(intColumnNumber).TextBox...
 
Back
Top