Avatar of Barry Cunney
Barry Cunney
Flag for Ireland asked on

VB 6 DataGrid - Change specific row backcolor based on cell value

Hi Guys,
Is it possible to chnage the back color of specific rows in VB datagrid based on value in cell on that row - sort of like conditional formatting.

I have a data grid coming from an Access table and there is an Include field in the table - For every row that the Include field = "Yes" I want o color the row in blue.



Cheers


B Cunney
Visual Basic Classic

Avatar of undefined
Last Comment
Computer101

8/22/2022 - Mon
JackOfPH

You can't. Datagrid doesn't support it. May be you could googled for third party control.

I think one of the option is using the true dbgrid control. It has more properties compared to dbgrid control.
JackOfPH

May be you could try this free grid...
http://vbaccelerator.com/codelib/sgrid/sgrid.htm
Barry Cunney

ASKER
Hi Guys,
I was able to this with an MSFlexGrid - There are cell backcolor and cell forecolor properties for this grid

I populate the grid with data from an MS Access table referenced as an ADO recordset, set up in a Data Environment.
As I am populating each record in the MS Flex grid, I check for the relevant criteria(i.e. a certain entry in a certain field and if this entry exists for the current record I simply set the cell backcolor to blue.


Cheers



B Cunney
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Computer101

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question