|
-
Feb 10th, 2009, 08:18 PM
#1
-
Feb 10th, 2009, 08:26 PM
#2
Re: ToolTipText in UserControl
Tooltip property will "appear" when you add UserControl to any form.
However, if UserControl contains any child control (label, textbox, etc) then you may assign individual ToolTips for those controls.
So, at run time your user control may have multiple tooltips - one general and one for each child control.
-
Feb 10th, 2009, 08:35 PM
#3
Re: ToolTipText in UserControl
As RhinoBull pointed out, the tooltip is assigned not by the usercontrol (uc). When a user adds your uc to their form/container, then the user can assign a tooltip. Think of your uc in terms of other VB controls, those controls do not assign tooltips, rather the user does when they add the control to the project.
Though you can create your own api tooltip, it may be confusing to the user if they also assigned a tooltip. There are hacks around this, but again, wouldn't recommend it.
-
Feb 10th, 2009, 08:55 PM
#4
Re: ToolTipText in UserControl
Oh man how did I miss that? 
I added it to my form and still didn't see a ToolTipText property but now I see it.
Thanks.
-
Jun 4th, 2009, 03:10 AM
#5
Junior Member
Re: [RESOLVED] ToolTipText in UserControl
Hi guys,
I am trying to get the tooltiptext property as well...
After read the posts, I still cannot get that property..
What I am trying to do is showing a tooltip when a mousehover a label.
I tried with SetToolTip ( not tooltiptext because i couldn't find it ) but nothing is shown when I hover the label. What have I done wrong?
-
Feb 29th, 2024, 08:22 AM
#6
Hyperactive Member
Re: [RESOLVED] ToolTipText in UserControl
I know this is an old topic, but I was also searching the forums and could not find an answer on how to get the ToolTipText of the UserControl (as a designer of the UserControl).
The following don't work, UserControl.ToolTipText or Me.ToolTipText.
But if you need to access the ToolTipText on runtime, so what the user of the control set during designtime or on runtime, you can access the ToolTipText using UserControl.Extender.ToolTipText
-
Feb 29th, 2024, 01:11 PM
#7
Re: [RESOLVED] ToolTipText in UserControl
The ToolTipText (for a user control, UC) is one of the Extender Properties that you always get when you use this UC on a form. As such, it's not really meant to be used within the UC's code itself. If you did, you wouldn't know which instance of the UC's ToolTipText property you were talking about.
So, if you have a UC on your form named "MyUc", you'd get to the ToolTipText property by: Debug.Print MyUc.ToolTipText
As we see, we just use the actual name of the control as it appears on our form. From within the form's code (but not the UC's code), we've got direct access to all of these ToolTipText properties for all the controls on the form.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Feb 29th, 2024, 06:38 PM
#8
Hyperactive Member
Re: [RESOLVED] ToolTipText in UserControl
 Originally Posted by Elroy
If you did, you wouldn't know which instance of the UC's ToolTipText property you were talking about.
What are you talking about? When developing a UserControl and I read the UserControl.Extender.ToolTipText from within the usercontrol, like the event UserControl_MouseMove() , I get the ToolTipText of that specific instance which is placed on the form. Even if I have a 100 of my UserControls on the same form, or even in a control array, UserControl.Extender.ToolTipText gives me the ToolTipText of that one instance and not random of any of the other instances places on a form.
 Originally Posted by Elroy
So, if you have a UC on your form named "MyUc", you'd get to the ToolTipText property by: Debug.Print MyUc.ToolTipText
Really? I would not have guessed that.......
 Originally Posted by Elroy
As we see, we just use the actual name of the control as it appears on our form. From within the form's code (but not the UC's code), we've got direct access to all of these ToolTipText properties for all the controls on the form.
Have you ever created your own usercontrol? If so, you would know that it is very handy to know what the user of your control has entered in certain properties from within your usercontrol, it's even basic needs, as without knowing the value of properties within your usercontrol, you can't really do anything. And in this case, I need to know from within my usercontrol what the user has entered as ToolTipText, and I want to know WHEN the user changes the value so I can do stuff with it. That's how you create a UserControl.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|