HowTo Dynamic ToolTip or changing tooltip on one button

vb.net, winforms

Solution

Given a tooltip named `ToolTip1`, then you can set variable text to a control, like this:

Dim myToolTipText = "Dummy text"
ToolTip1.SetToolTip(Me.Button1, myToolTipText)

Problem

I have a small VB winforms app with a forward and back button. These two buttons allow you to cycle through numerous "pages". I would like to display the next and previous page title in tooltips when the mouse hovers over the buttons(arrows). Example, when hovering over the left arrow button, I would like to display the name previous page. So page 1 is applications, page 2 is emails, page 3 is pdf documents etc... I added the tooltip property from the toolbox in Visual Studios, but it only allows me to type a single item as opposed to scrolling through my list of pages and determining what the previous page name is and displaying it. The page or form itselt doesn't change, and neither do the buttons, just a panel contained inside the form has the "pages" that change, so I need to be able to write a function that figures out which page is previous and which page is next on the fly when mousehovers the buttons in question... Then returns the data so I can display it in the tooltip. Better Question; How can I pass any variable into a tooltip instead of setting it as a property.

Original source