Solved

Creating tooltips

Posted on 2006-11-23
5
194 Views
Last Modified: 2010-04-23
Below is the code i am using to create labels on runtime, my question is how can i add tooltips to these labels?


Dim sectortime As DateTime
Dim sectors(250) As Label
Dim sectip As ToolTip
Dim seclength As Integer
Dim secposition As Integer
Dim sectorto As String


With sectors(currentlabelnumber)
                                .Left = secposition + seclength - 5
                                .Top = 131 + (k * 182 - 150 + value)
                                .Text = sectorto
                                .AutoSize = True
                                .BorderStyle = BorderStyle.FixedSingle
                            End With
                            Me.Controls.Add(sectors(currentlabelnumber))
                           
 sectip.SetToolTip(Me.sectors(currentlabelnumber), sectortime)

                            currentlabelnumber = currentlabelnumber + 1

As you can see i have tried adding a tooltip, but on runtime i am informed that object refrence not set to an instance of an object.

Any help is much appreciated.
0
Comment
Question by:dr_dudd
  • 3
5 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 18003711
Hi dr_dudd,

You need to add a ToolTip component to your form and call ToolTip1.SetToolTip(YourControlName, "Your tip")

Cheers!
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 18003721
0
 
LVL 2

Author Comment

by:dr_dudd
ID: 18003752
Hi emoreau

I have already tried this.... if you look closely at the code in the question you will already see the lines...

Dim sectip As ToolTip

sectip.SetToolTip(Me.sectors(currentlabelnumber), sectortime)
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 18003800
Try:

                sectip= New ToolTip
                sectip.SetToolTip(Me.sectors(currentlabelnumber), sectortime.ToString)
                sectip.Active = True
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 18003813
dr_dudd,

but I don't think that your Tooltip as you defined it belongs to the form so the form cannot show it! Try adding a Tooltip component and use that one.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now