Set a background color

K

Kalpana

Hi All

Can anybody please tell me if this is possible:
I have multiple dropdowns with 4 colors in each of them and text boxes next
to each of the drop downs. As the user picks the color - on the dropdown
"Changed Event" I want to fill the text box with the color chosen from the
drop down. Is this possible, and if so can anyone send me the line of code to
change the background color for the text box?

Thanks
Kalpana
 
S

S.Y.M. Wong-A-Ton

You do not have to write code for this; you can use conditional formatting on
the text box to show the selected color based on the value of the drop-down
it belongs to. If you still want to use code, you can create an extra field
to hold the selected value of the drop-down, set conditional formatting on
the text box based on the value in the extra field, and then write code in
the Changed Event of the drop-down that will set the value of the extra field
to the selected color in the drop-down. This will trigger the color of the
text box to change. Whichever way you decide to go - code or no code - you
will have to use conditional formatting to set the color of the text box, so
the first option I mentioned (no code) is the shortest and easiest path to
travel.

Since you mentioned "Changed Event", I assume you are using InfoPath 2007,
so to programmatically set the value of a field, see
http://enterprise-solutions.swits.n...ions-faq.htm#how-to-set-field-value-from-code
 
Top