Search   Articles   Dev Forums   Personalize   Favorites   Member Login   ASP.Net Hosting
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Sunday, February 19, 2006

Search Directory
Trusted by over 7 million customers!
ASP.NET
VB.Net
C-Sharp
SQL Server
 
More Partners >>

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
Name:  K.A.G.S. 
Wow, wonderful, and I was confusing MS removed tooltip from .NET, cool, nice, thanks a lot.

Name:  Rajkamal 
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

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



Disclaimer - Privacy
Copyright © 2008 DevASP.net