Solved

CHANGING COLOR IN DBGRID OR MSFLEXGRI

Posted on 2002-06-17
5
139 Views
Last Modified: 2010-05-02
how can i change the color of the newly inputed data into the grid or change the color of the existing data in the grid. if i want the first data to be yello it will be yello and if i want the third data or row in the grid to be green it will be green. how can we do that?
0
Comment
Question by:therooster
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 7083598
Not using a DBGrid, is the simple answer.

The DBGrid is great for in-cell editing etc but doesn't support complex cell formatting, the flexgrid on the other hand supports the complex cell formatting but not the in-cell editing (though you can simulate this very effectively).

Using a flexgrid:

With MSFlexgrid1
  .Redraw = False
  .Col = 3
  .Row = 3
  .CellBackColor = vbBlue
  .CellForeColor = vbYellow
  .Col = 5
  .CellBackColor = vbRed
  .CellForeColor = vbWhite
  .Redraw = True
End With
0
 
LVL 1

Expert Comment

by:Benjy
ID: 7083867
TimCottee is right, but just a note:
if you want to color the entire row make the following changes:

With MSFlexgrid1
 .Redraw = False
 .FillStyle = flexfillrepeat
 .Row = 3
 .RowSel =3
 .Col = 0
 .ColSel = .Cols -1
 .CellBackColor = vbBlue
 .CellForeColor = vbYellow
 .Row = 5
 .RowSel = 5
 .Col = 0
 .ColSel = .Cols -1
 .CellBackColor = vbRed
 .CellForeColor = vbWhite
 .Redraw = True
End With
0
 

Author Comment

by:therooster
ID: 7088538
how about if the grid contains records.. and each records corresponds to a color scheme. so after data1.recordset.refresh the color will be back to normal.. is there another way? or an api functions of doing this?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7911076
Hi therooster,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TimCottee's comment(s) as an answer.

therooster, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7967650
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

10 Experts available now in Live!

Get 1:1 Help Now