By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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


Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.