Help In Tooltip+statusbar

nido12

Member
Joined
Dec 12, 2005
Messages
5
Programming Experience
1-3
DEAR ALL

I HAVE A THING THAT IS GETTING IN MY NERVES:confused:
i have a status bar
i want to make a tooltip linked to it...so everytime i click on a text book i see it's tooltip in the statusbar
i downloaded a demo from the web but i didin't get it
they have put 2 tool tip one normal and other linked to the status bar??:eek:
since they have no explanation i didn't get it

PLEASE CAN YOU TELL ME HOW TO DO IT....I NEEED IT URGENTLY
THANKS
 
If i understand well your question It can be done as it follows:

first add couple textBox controls on the form and set the tooltip values for eace of them. Then make one procedure i.e. showToolTip()
VB.NET:
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] showToolTip()
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] xControl [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Control
[/SIZE][SIZE=2][COLOR=#0000ff]For [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] xControl [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Controls
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] xControl.GetType [/SIZE][SIZE=2][COLOR=#0000ff]Is[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]GetType[/COLOR][/SIZE][SIZE=2](TextBox) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]AddHandler[/COLOR][/SIZE][SIZE=2] xControl.MouseHover, [/SIZE][SIZE=2][COLOR=#0000ff]AddressOf[/COLOR][/SIZE][SIZE=2] tooltiping
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Next
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]



VB.NET:
[COLOR=#006400]'this will be handler[/COLOR]
[SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] tooltiping([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs)
[/SIZE][SIZE=2][COLOR=#0000ff] Me[/COLOR][/SIZE][SIZE=2].StatusBar1.Text = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].ToolTip1.GetToolTip(sender)
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
Then just call the showToolTip from LoadEvent i.e.
VB.NET:
[COLOR=#0000ff][SIZE=2]Private [SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2][COLOR=#000000] Form1_Load([/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2][COLOR=#000000] sender [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#000000] System.Object, [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2][COLOR=#000000] e [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#000000] System.EventArgs) [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Handles [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2][COLOR=#000000].Load[/COLOR]
    [/SIZE][/SIZE][/COLOR]showToolTip()
[COLOR=#0000ff][SIZE=2][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[/SIZE][/COLOR]

Regards ;)
 

Attachments

  • StatusBarToolTip.zip
    23.7 KB · Views: 34
couldnt you use the enter event of the textbox to set the statusbar panel to the textbox's tooltip?
like:
VB.NET:
Private Sub Textbox1_Enter (...) Handles Textbox1.Enter
  statusbarPanel1.Text = Textbox1.Tooltip1
End Sub
or something
 
Well, if he wants to show tooltip text for only certain control or few of them it is possible in a way as you mentioned above but say you have 30+ textBox controls on the form. then i beleive it is easier to iterate to the controls collection and find only textBox controls that have set tooltip text and proceed to StatusBar. Right?

Regards ;)
 
Why not use JB's method with a single event handler for all TextBoxes:
VB.NET:
Private Sub TextBox_Enter(...) Handles ...
    myStatusBar.Text = myToolTip.GetToolTip(CType(sender, Control))
End Sub
 
Back
Top