Here you would need to use my FAQ, but instead loading a picture for the button, you would need to change the text property (of the label or other control):
lblButton.ForeColor = vbRed (or what other color you want it to be).
"MouseOver" combined with "MouseOff" events (like in HTML) are complicated in VB.
I hope this helps? Best Regards and many Thanks!
Michael G. Bronner X-)
"They who drink beer will think beer." Washington Irving
A module is like a form, just that it doesn't have any visual representation within your project. Think of a module as a package, where you store functions and subs that can be used in the entire project.
To create a module, click on Project (in the menu), then Add Module. To insert your code int the module, simply double click on the module in your Project Group window.
If your familiar with C++, think of a module as a .cpp file containing methods.
Modules are most often used to store functions and procedures that get called repeatedly from various forms, thus reducing the amount of code in your project.
Hope this helps Best Regards and many Thanks!
Michael G. Bronner X-)
"They who drink beer will think beer." Washington Irving
When using a module, you don't actuallyt call the module. Rather, you called the functions that the module contains.
In the module you write out the functions the same way you would in a form.
Say your module contained the sub:
Public MySub(Change as String)
blabla
End Sub
you would call it from your form like this:
Call MySub("blabla"
Thats just an example. Best Regards and many Thanks!
Michael G. Bronner X-)
"They who drink beer will think beer." Washington Irving
Those colors will stay when the mouse moves out of the box (no mouseleave event) unless you use a mousemove for the surrounding form or frame to reset them. Fastest is to use a form level object variable to hold NOTHING or the last object for which color changed. If the controls have different default colors then you will have to save and restore the forecolor also.
John is right, VB does not hove MouseOver and MouseOff events - I was merely referring to HTML (hope I didn't confuse you there).
The only proble with using a form-level MouseMove event is that you can't have the adjacent areas of the button be covered by a different object, otherwise the Form1_MouseMove() event won't register (as far as I'm aware of anyway).
Thats why I went the somewhat troublesome rout using API call and a timer. (Note: when using a timer, be sure to set its interval to something smaller or equal to 100, otherwise it might use up too much system resources.)
However, if you have adjacent areas around the button displaying only the form, then use John's code, you'll save yourself some work. Best Regards and many Thanks!
Michael G. Bronner X-)
"They who drink beer will think beer." Washington Irving
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.