?
Solved

DataGrid and Color

Posted on 2003-02-25
3
Medium Priority
?
599 Views
Last Modified: 2012-05-04
What i have is a datagrid with in column(7) a colour such as blue,red and yellow. There are numerous rows in the datagrid. What i would like is to check each column(7) for a colour and change the whole row to that colour! Something like

If DataGrid1.Columns(7) = "Red" Then
DataGrid1.Row.ForeColor = vbRed
End If

It doesnt seem to work
0
Comment
Question by:Briankerr
[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
3 Comments
 

Expert Comment

by:vbprogrammierer
ID: 8017862
Hi,

you can try the following:

set the grid pointer to column 7 with
 datagrid1.col=7
compare color
 if DataGrid1.CellBackColor = vbRed Then    or
 if DataGrid1.CellBackColor = RGB(255,0,0) Then


for changing the whole row color:
(i think the first row is fixed)
With DataGrid1
    .Col = 7
    .Row = 1
    .RowSel = .Rows - 1
    .CellBackColor = <color>
End With

but remember that changing the .Col or .Row fires an EnterCell and LeaveCell

hope this can help you

Dieter
0
 
LVL 2

Accepted Solution

by:
IeuanJ earned 60 total points
ID: 8023714
CellBackColor and RowSel is NOT a VB datagrid property, it is an MS FlexGrid property.  Which you would have to use to alter the background colour of specific cells, DataGrid does not support this functionality as far as I am aware.
0
 

Author Comment

by:Briankerr
ID: 8032951
Looks like you're right!
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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
Suggested Courses

765 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