Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating tooltips

Posted on 2006-11-23
5
Medium Priority
?
203 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 70

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 70

Accepted Solution

by:
Éric Moreau earned 1000 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 70

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses

824 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