Results 1 to 6 of 6

Thread: "Hover text" on a control

  1. #1

    Thread Starter
    Lively Member blacksaibot's Avatar
    Join Date
    Jan 2009
    Location
    East Coast, USA
    Posts
    94

    Question "Hover text" on a control

    In HTML you can add an ALT property to an IMG tag so when a user hovers over a picture, a little box appears with a description.

    How can I add this feature to a button or other control within my form?

    I assume that I would edit the method "MouseEnter" (I am guessing that means when the mouse "enters" the area of the button)?
    But I wouldn't even know where to start as far as coding the little box that would appear with a description.

    I didn't find anything within the Properties box (like where you can specify the TEXT to appear on a control)
    Or perhaps I overlooked it (or its called something that doesn't make it obvious)

    Thanks for your help

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: "Hover text" on a control

    You mean ToolTips? Add a ToolTip control to the form, then set the ToolTip Text property on each control, if there is no text set then nothing will be shown when the mouse is hovered over the control.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  3. #3

    Thread Starter
    Lively Member blacksaibot's Avatar
    Join Date
    Jan 2009
    Location
    East Coast, USA
    Posts
    94

    Re: "Hover text" on a control

    Quote Originally Posted by JuggaloBrotha View Post
    You mean ToolTips? Add a ToolTip control to the form, then set the ToolTip Text property on each control, if there is no text set then nothing will be shown when the mouse is hovered over the control.
    So within Button1.MouseHover()
    ToolTip1.what?

    I dont see a .text or anything related.

    Do I call the tooltop's .popup and give it a string as a parameter or something like that?

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: "Hover text" on a control

    You don't use any events and you don't call the tooltip to have it display, it does that automatically.

    Add a ToolTip control to your form (drag it from the toolbox and drop it on your form) now select one of the buttons and look for the "ToolTip on ToolTip1" property in the properties window. Type in some text then run your program, hover the mouse of that button and the tooltip automatically shows after 3 seconds (you can change the delay time on the ToolTip control too)
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: "Hover text" on a control

    Just one small thing that I always like to point out for the sake of being precise: the ToolTip is not a control; it's a component. If a class doesn't inherit the Control class then it's not a control. Any class that implements IComponent can be designed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Lively Member blacksaibot's Avatar
    Join Date
    Jan 2009
    Location
    East Coast, USA
    Posts
    94

    Re: "Hover text" on a control

    Okay I got it to work. THanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width