Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Working with Tool Tip Control in VB.Net

Author: DevASP
Download Source Code : 367_ToolTip_control.zip

In this simple article you will learn that how can work with tool tip control.

Create a New Project in VB.Net. Drag a tool tip control from tool box and place on form. Now write code on form load event of the form1

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Me.ToolTip1.ShowAlways = True

        Me.ToolTip1.ReshowDelay = 10

        Me.ToolTip1.AutomaticDelay = 100

 

        Button1.BackColor = Color.LightGray

        Button2.BackColor = Color.LightGray

        Button3.BackColor = Color.LightGray

        Button4.BackColor = Color.LightGray

        Button5.BackColor = Color.LightGray

        Button6.BackColor = Color.LightGray

 

        Button1.Text = "CLICK ME TO SET ME TOOL TIP TEXT"

        Button2.Text = "CLICK ME TO SET ME TOOL TIP TEXT"

        Button3.Text = "CLICK ME TO SET ME TOOL TIP TEXT"

        Button4.Text = "CLICK ME TO SET ME TOOL TIP TEXT"

        Button5.Text = "CLICK ME TO SET ME TOOL TIP TEXT"

        Button6.Text = "CLICK ME TO SET ME TOOL TIP TEXT"

 

End Sub

Now write code on the buttons click events

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        ToolTip1.SetToolTip(Button1, "Button 1")

 

End Sub

 

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

 

        ToolTip1.SetToolTip(Button2, "Button 2")

 

End Sub

 

 

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

 

        ToolTip1.SetToolTip(Button3, "Button 4")

 

 

End Sub

 

 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

 

        ToolTip1.SetToolTip(Button4, "Button 3")

 

End Sub

 

 

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

 

        ToolTip1.SetToolTip(Button6, "Button 5")

 

End Sub

 

 

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

 

        ToolTip1.SetToolTip(Button5, "Button 6")

 

End Sub

Article Comments
Wow, wonderful, and I was confusing MS removed tooltip from .NET, cool, nice, thanks a lot.

Posted on 1/10/2007 8:14:08 PM by K.A.G.S.

hi folks,

is it possible to hav tool tip for a menu item ? fr example: i am havng a menuitem as File--> New,Open,Save ,Save As like that.......
is it possible to hav tooltip for the Menuitem New??

please help me........

Thanks in Advnce
Rajkamal.r

Posted on 1/21/2008 12:48:58 AM by Rajkamal

This is a good programming structure.
Abbass Mustafa
Software Engineer
SOFTFLOW Company.

Posted on 2/22/2008 7:48:34 AM by Abbass Mustafa

this tool tip menu is helpful me for the project development in menu.
thanks

Posted on 7/21/2010 2:45:36 AM by hari ghimire

Another approach is

I would use:
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click
ToolTip1.SetToolTip(sender, sender.name.ToString)
End Sub

Posted on 8/13/2010 5:16:03 AM by pf

thnk u

Posted on 11/7/2010 8:16:34 PM by Eid Almubarak

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Working with Tool Bar Control in VB.Net

Disclaimer - Privacy
© 2002-2017 DevASP.net