I have a button that I have set to false on runtime until some event occurs. I would like to display a tooltip for the disabled button to inform the user what has to be done to enable it. tooltip doesn't show while the button is disabled but shows while it's enabled. Is there a way to show the tooltip for the button while it's disabled?

thanks

Hi,

No Events are Fired when the Control is disabled.. But there is a way around, :
Place a label on the Form (near to the command button) and in Form's Mouse Move, find the Pointer, if it is hovering over the disabled Command button, then, show the label (as tool tip)
set these properties for Label:
Visible = False
Caption = "My New Tool Tip"
and write this code in Form MouseMove:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (X >= Command1.Left And X <= (Command1.Left + Command1.Width)) And (Y >= Command1.Height And Y <= (Command1.Top + Command1.Height)) Then
        Label1.Visible = True
    Else
        Label1.Visible = False
    End If
End Sub

Regards
Veena

thank you very much for the suggestion and it worked beautifully, I just had to change Y>=command.height to y>=command.top in the clause. Is this the only way to show a tool tip like message on a disabled button? Is there a way to actually show the tooltip?

Hi,

There are few more ways where in you can show tool tip for disabled Command button, You can Place the Command into a frame or Label and set its height, width , Transparent , and give the same tooltip for the parent control..

Regards
Veena

This article has been dead for over six months. Start a new discussion instead.