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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamicfontbold

Status
Not open for further replies.

Bertiethedog

Programmer
Feb 8, 2007
118
GB
Am i going dippy? dynamicfontbold will not accept a .t. or .f.

error = (data type is invalid for this property)

Code:
 thisform.pgfDetails.page6.gridPriv.column1.DynamicFontBold = IIF(RECNO()%2 =1,.t.,.f.)






I thought it only accepted logical expressions

Rich
 
Like the other DynamicXXX properties I think you will find it needs an expression that evaluates to .T. or .F., not the result of the expression. Try enclosing the expression in quotes like this:

Code:
thisform.pgfDetails.page6.gridPriv.column1.DynamicFontBold = "IIF(RECNO()%2 =1,.t.,.f.)"





----
Andy Kramek
Visual FoxPro MVP
 
Rich,

Andy's right. If you don't have the quotes, VFP will evaluate the expression at the time that you set the property, and the result of that expression (.t. or .f. in this case) will be used as the setting, which is not what you want.

By the way, whenever you have an IIF() where the second and third arguments are .T. and .F. (or vice versa), you can always shorten it as follows:

Instead of this:

Code:
IIF(RECNO()%2 =1,.t.,.f.)

you can do this:

Code:
RECNO()%2 =1

Note that this is just a general observation, and is not directly connected with your original question.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I did get it to work by putting it into the graphical properties of the grid, I wanted to put it into the init code for the grid. Then at least all the setup is in the same place.

Will try again


Thanks
 
Rich,

By "graphical properties", I assume you mean the property window that appears when you open the form designer. If so, then you were right to omit the quote marks at the point. It is only when you set the property in code that you need the quotes.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Sorry about the delay, I thought I had thanked everybody for their help.

Kind Regards

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top