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

changing row color dynamically

Status
Not open for further replies.

FOXPROG

Programmer
Jan 14, 2001
51
US
I have a grid that I want to have the first row in green and all other rows in red. the problem is the gird is filled with filtered records so I never know what record number is being displayed in the first row. Does someone have an idea how to make the first row always green no matter what record is displayed?
 
Hi FoxProg,

One solution would be to add a sequence number field to the table. Immediately after applying the filter, populate the sequence number with consecutive numbers, which you could then use as the basis for your DynamicBackColor setting.

By the way, it's often recommended not to use a filter with a grid, for performance and other reasons. So, a better solution might be to select the required records into a cursor, in the order that you want them to appear in the grid. Then use the cursor's record number as the basis for the DynamicBackColor.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I agree... best approach would be to select to a cursor, then you would know that grid line 1 is record 1...

Andy Snyder
SnyAc Software Services Hyperware Inc.
AmTech Software Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top