How to add ToolTips to any Component

Use this board to post your code snippets - tips and tricks
2 posts Page 1 of 1
Contributors
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

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
Image
User avatar
Nery
Co-Admin Moderator
Co-Admin Moderator
Posts: 1117
Joined: Mon Sep 07, 2009 8:11 pm

*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
2 posts Page 1 of 1
Return to “Quick Snips”