Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating tooltips

Posted on 2006-11-23
5
Medium Priority
?
200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

660 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