I have a very simple control in VB 2010. It has a label and a text box. I also added a ToolTip control that is attached to the bottom of the screen. I then setup a property so I can set the tool tip adter I drop the new control on a form This works for the form that the text and label are placed on, but the text and the label never inherit the tool tip. I tried to assign them but that doesnt work as the tooltop is not available on the code side. the property page does have a place for the tooltup but I cant get to it from the code.
any ideas?
Public Property AToolTip() As UltraToolTipInfo
Get
AToolTip = Me.ToolTipT.GetUltraToolTip(Me)
End Get
Set(ByVal value As UltraToolTipInfo)
Me.ToolTipT.SetUltraToolTip(Me, value)
End Set
End Property
Hi,
I'm afraid I don't understand your question.
mworsnop said:This works for the form that the text and label are placed on, but the text and the label never inherit the tool tip.
You are saying here that it works and also that it does not work, and I am not clear on the distinction you are making. When does this work and when does it not work?
Are you trying to apply a tooltip to the TextBox, the the Label, or the entire control?
Sorry I wasnt very clear; Using the set property I was able to set the ToolTip property for the main container. In this case its a form that has a label and a textbox on the form. So when I place the new control on a new form, I am able to set the AToolTip using the property as I showed above.
However the textbox and the label do not have a tooltip attached to them. So when I run the mouse over my control the tooltip only pops up when I am on the form part of the control.
I would like to be able to attach the same tooltip using the code above to the label and the textbox so when the mouse moves over any part of the control the tooltip will be triggered
thanks for the help!
Thanks Mike, Looks like I am going to use the MouseEnter to show the tool tip. I was experimenting with this idea yesterday and looks like it will work.
Ah, okay, I see.
The tooltips work based on the MouseMove event. So the underlying UserControl will not get these mouse messages if there is a control on top of it that gets them instead.
There are a couple of potential solutions here.
One thing you could do is copy the same Tooltip to each control inside the UserControl individually. I think this will work, but it's probably not ideal, because the tooltip will likely hide itself and then re-show when you move the mouse from the Label to the TextBox. So it won't look right to the user.
Another approach would be not to assign the tooltip to any control but to simply trap the MouseEnter and MouseLeave events of all of the controls in the UserControl and then call ShowToolTip and possibly HideToolTip yourself in code. That would you can control when the Tooltip is shown.