Page 1 of 1

How to add ToolTips to any Component

Posted: Wed Sep 16, 2009 8:29 pm
by hungryhounduk
Hi All
I have been trying to work this out for ages and have just got it too work wahooo;
Here is a Bit of EASY Code so that you can add Tooltips to any Component you put on a Form

Drag a TOOLTIP COMPONENT on to your Form and add a TEXTBOX and add the code below IN YOUR FORM LOAD


Code: Select all
Dim Tips As New Windows.Forms.ToolTip
        Tips.SetToolTip(TextBox1, "Codenstuff is the Dogs Dangley's")
Then for each Component you put on your Form Just repeat the code ( but leave out the First line starting with DIM)

Like this

Dim Tips As New Windows.Forms.ToolTip
Tips.SetToolTip(TextBox1, "Codenstuff is the Dogs Dangley's")
Tips.SetToolTip(Button1, "Click here to go to Codenstuff")
Tips.SetToolTip(Button2, "Click to Visit my Site")



Change the Textbox1 (for the name of your Component name ( ie Button1, Listbox, Label1, you can add this to Tabbed Components as well and so on ) and just change the text between the brackets to say what you like...

This can be used on Buttons as well and just about any other Component wahooo;

Enjoy

Chris

For some reason it has shown this Image over the Code??????? :cry: But anyway the Code above is what i used and works great

Image

Re: How to add ToolTips to any Component

Posted: Wed Sep 16, 2009 9:54 pm
by Nery
*Thanked*

Very nice snippet, I really didn't knew it was possible to add a tooltip to a textbox like that, simply call the tooltip function :O