Applying the same code automatically to various fields

garyholc

Registered User.
Local time
Today, 22:51
Joined
Jul 15, 2008
Messages
64
I have a form with a lot of fields on it. I am toying with the idea of making the field change colour (say turn the background yellow) when the field has focus, and then go back to white when it loses focus. Is there a quick way to do this to all the fields rather than adding a few lines of code to change the colour to every field?
 
I have a form with a lot of fields on it. I am toying with the idea of making the field change colour (say turn the background yellow) when the field has focus, and then go back to white when it loses focus. Is there a quick way to do this to all the fields rather than adding a few lines of code to change the colour to every field?


I do this without any code, just properties. Then I can use the format painter to copy it to other controls.

Step 1: Set the back ground color to yellow (or what ever color you want the field when entered)
Step 2: Set the Back Style to Transparent

Now when you enter the control, the background color becomes visible. When you exit the control, the background becomes transparent again.
 
Last edited:
Another slight variation would be to do this with the first condition of conditional formatting. You can also copy this with the format painter. If you format the first one you can double click the painter and then just click on all controls you want to apply the format to.

HTH

Tom
 

Users who are viewing this thread

Back
Top Bottom