changing msflexgrid row to a different color if the number displays negative.

Since I was able to display negative numbers in an msflexgrid,
 I would also like to display it in red for that row. How to do that?

Part of the code I'd like to insert the code... to change row color if negative

   With grdEquipData
        'Check if "Cost" and "Qty" are available
        If (Trim(.TextArray(.row * .Cols + 7)) <> "" And Trim(.TextArray(.row * .Cols + 3)) <> "") Then
            'Total Cost = Unit Cost * Qty
            .TextArray(.row * .Cols + 8) = FormatNumber((.TextArray(.row * .Cols + 3)) * Val((.TextArray(.row * .Cols + 7))), 2)
        End If
 end with
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

With MSflexgrid there is no straight way to set color to a full row. You have to set color cell by cell. Lets say you have 5 columns and and want to set color of 4th row to yellow, then this is how you will do it:

For intLoop=0 to 4
 With MSHFlexgrid1
 End With

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
try this

With grdEquipData
    .Row = r            'set the row you want to change the color
    for c = 0 to .Cols -1            'loops through all the columns in the row nd changes its color
        .Col = c
        .CellBackColor = vbRed
    next c
End With

hope this helps
zachvaldezAuthor Commented:
only when it is negative number though..
i'd like the row to display color red...
.TextArray(.row * .Cols + 8) = FormatNumber((.TextArray(.row * .Cols + 3)) * Val((.TextArray(.row * .Cols + 7))), 2)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.