ToolTip question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI everyone,

So, I have many buttons, and all of them must show a tooltip with the same
string, except one word, that I must read this owrd from a variable.
Although, the "ToolTip on x" property do not let me to write a little
paramter of concanatantion (at least I was not able to do this). Does someone
has any ideas?

Any help will be very useful.
Thanks in advance.
 
HI Imran

I tried this way, but if the value of the variable changes, the tooltip text
still the same =(

Thnaks anyway
 
I'm not quite following - its working fine for me. Could you post the code
that's not working as expected for you? Maybe that'll help us figure out
what's going on.

Imran.
 
OK, her it is:

<code>

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()
Me.tooltip = New ToolTip()
With tooltip


Dim sr As PictureBox
For Each sr In Me.Controls
tooltip.SetToolTip(sr, "The actual rating is " &
CDbl(Me.valued \ 2).ToString & ".")
Next
End With

End Sub

</code>

I do not have to do this routine everytime my variable changes, do I?
If so, this is the problem, but I think that must be other easier way


Thanks again
 
duh! sorry - was brain dead at the end of the day :-S

you're right - for the same control, if you want to change the tooltip text,
you'll have to call SetToolTip again with the changed value of the variable
passed in. Once you set the tooltip text with SetToolTip (which may or may
not include a variable), the tooltip text stays the same until you call
SetToolTip again with the changed text. So yes - I'm afraid you'll have to
loop the controls and set the tooltip text everytime your variable changes.

Imran.
 
No problems,

I did not find any other better way, so I am going to to this, however I am
also afraid about loop the controls everytime the variable changes.

Thanks guy, you helped me a lot.

Lucas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top