Solved

SSDBGrid: change color of a cell

Posted on 2001-07-09
2
1,466 Views
Last Modified: 2007-11-27
I'm using SSDBGrid to display data. I wanna change color (backcolor and forecolor) of the cells which meet some conditions (eg. quantity exceed 100). Could any body show me how to change the color of a cell?

Thanks a bunch
nguyenn
0
Comment
Question by:nguyenn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
rkot2000 earned 100 total points
ID: 6265415

you need to create a StyleSets (where you can set backcolor, forecolor, and ....)in the grid

"24Hours", "ActiveColumn" - names for the style set

and use the following event to change color:

Private Sub DBGridSelect_RowLoaded(ByVal Bookmark As Variant)
Dim i As Integer

  If DateDiff("d", Format(DBGridSelect.Columns("Date Received").Text, "mm/dd/yyyy"), Now) > 1 Then
    For i = 0 To DBGridSelect.Cols - 1
      DBGridSelect.Columns(i).CellStyleSet "24Hours"
    Next i
  Else
    For i = 0 To DBGridSelect.Cols - 1
      DBGridSelect.Columns(i).CellStyleSet "ActiveColumn"
    Next i
  End If

End Sub
0
 
LVL 1

Author Comment

by:nguyenn
ID: 6265466
Thanks rkot2000, your help is very appreciated

nguyenn
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question