Création ToolTip DataGridView

sauce31 Messages postés 26 Date d'inscription mardi 14 avril 2009 Statut Membre Dernière intervention 2 juin 2009 - 28 mai 2009 à 16:47
sauce31 Messages postés 26 Date d'inscription mardi 14 avril 2009 Statut Membre Dernière intervention 2 juin 2009 - 28 mai 2009 à 17:40
Bonjour,

Dans un formulaire, j'ai un datagridview dans lequel je saisie des nombres.

Hors, certains valeurs saisies sont suivies du signe $ qui me permettront de convertir les valeurs en € suivant un taux préalablement saisie.

J'aimerais donc, qu'au passage de la souris sur une cellule ayant le signe $, un tooltip s'affiche et me marque la valeur en convertie en €.

En regardant certains forums, j'ai écrit ce code là :

Private
Sub DataGridView1_MouseMove(
ByVal sender
As
Object,
ByVal e
As System.Windows.Forms.MouseEventArgs)
Handles DataGridView1.MouseMove

Dim hitRow
As
Integer

Dim tool
As
New ToolTip

Dim hti As DataGridView.HitTestInfohti Me.DataGridView1.HitTest(e.X, e.Y)tool.ShowAlways

True

If hti.Type = DataGrid.HitTestType.Cell
And hti.RowY <> hitRow
Then
'And hti.RowIndex <> Me.DataGridView1.Rows Then      hitRow = hti.RowY

      tool.AutomaticDelay = 5000

      tool.InitialDelay = 5

      tool.ReshowDelay = 100

      If tool.Active =
True
Then            tool.Active =

False

      End
If

      If VB.Right(
Me.DataGridView1.Rows(hti.RowIndex).Cells(hti.ColumnIndex).Value, 1) =
"$"
Then            nbVal = Replace(

Me.DataGridView1.Rows(hti.RowIndex).Cells(hti.ColumnIndex).Value,
"$",
"")            valeur2 = nbVal * tx

            valeur2 =

"Valeur en euro : " & hti.RowY &
" " & hti.ColumnX
'& valeur2 & " €"            tool.SetToolTip(

Me.DataGridView1, valeur2)            tool.Active =

True

      End
If

End
If

End
Sub

Mais rien ne s'affiche. Quelqu'un pourrait m'aider.

Cordialement

2 réponses

steph064 Messages postés 90 Date d'inscription mardi 30 décembre 2008 Statut Membre Dernière intervention 10 juin 2009
28 mai 2009 à 17:09
C'est pas un truc du genre .showTooltip(tps en millisecondes) ?
J'ai pas encore touché aux tooltips, bidouille bidouille
0
sauce31 Messages postés 26 Date d'inscription mardi 14 avril 2009 Statut Membre Dernière intervention 2 juin 2009
28 mai 2009 à 17:40
Non, j'ai déjà "bidouillé" mais rien ne marche
0
Rejoignez-nous