Solved

Color for Data Grid

Posted on 2002-03-25
2
206 Views
Last Modified: 2010-05-02
Dear Experts,

I need to make some rows within the data grid to appear in other color if the particular record meets my criterias. I couldn't find a way to make a particular row to appear in color, but only the entire grid.

Thanks for any answer given.
0
Comment
Question by:MaxLen
2 Comments
 
LVL 6

Expert Comment

by:xSinbad
ID: 6895691
I dont think you can do that with a data grid but if you use a flex grid you can.

Below is a simple example of how to do this with a flex grid;

Private Sub Form_Load()
Dim i
For i = 1 To 10
MSFlexGrid1.AddItem "Test" & i, i
 If i = 5 Then
    MSFlexGrid1.Row = i
    MSFlexGrid1.CellBackColor = vbBlue
End If
Next i
End Sub


Cheers
Marcus
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 6895893
xSinbad is exactly right, you cannot do this with the standard datagrid, you either have to use the standard flexgrid control that ships with VB but this does not have the ability to enter data directly into cells, nor does it happily handle data-binding with ADO recordsets. Or you can buy a control which does it all such as the TrueDBGrid or VSFlexgrid from http://www.componentone.com
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 39
Hide vba in gp 7 93
Spell Check in VB6 13 112
Send outlook email from VBS Script 2 28
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

786 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