Solved

SSDBGrid: change color of a cell

Posted on 2001-07-09
2
1,417 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now