470,612 Members | 2,522 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,612 developers. It's quick & easy.

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

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

Jul 21 '05 #1
1 1324
Hm ok, I found it myself.. :-)

Just adding a Handler to the MouseMove-event of the
TableStyle.GridcolumnStyels(intColumnNumber).TextB ox...
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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


Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Gilgamesh | last post: by
1 post views Thread by Sangeetha | last post: by
24 posts views Thread by John Salerno | last post: by
5 posts views Thread by Steven Berkovitz | last post: by
1 post views Thread by daldridge | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.