Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF forecolor problem

Status
Not open for further replies.

bfwriter

Technical User
Jul 22, 2006
35
US
Hello friends,

Why won't this code be accepted in the Properties window of a text box?

IIF(table.logical_field, RGB(200,0,0), RGB(0,0,0))

When I try to enter this code it simply reverts to the default of 0,0,0.

Using VFP 9.0 with WinXP-Pro

Thanks much.
Ben
 
Oops, apologies. The question should read...

Why won't this code be accepted for ForeColor property, in the Properties window of a text box?
 
The properites only appears to accept a single color value. you should put your logic in a method in a control on the form such as the textbox's InteractiveChange.

Brian
 

Ben,

The short answer is that VFP can't interpret the expression (that is, the IIF()) at design time. If you type the expression into the property window, VFP would have to actually execute it as soon as you finish typing. It doesn't work that way.

You need to assign the value in your code. Where you do that depends on how and when the table's logical field gets its value. If the field is present when the form is instantiated, you can put the code in the textbox's Init. If the value of the logical flag changes according to what the user enters in the field, the code could go in the InteractiveChange or the LostFocus.

Hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top