Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 25th, 2005, 05:07 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Color the row in the datagrid based on date compar

In my application i am displaying few records in the datagrid and there are two columns with date.I have to change the background color of the row if the first columns date is greater than the second columns row. I have to compare the two dates in the columns of the datagrid and change the background of the particular row.

Thanks in advance

Old March 28th, 2005, 01:40 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr

dynamically change the color of row in a DBGrid:

procedure TForm1.DBGrid1DrawColumnCell
   (Sender: TObject; const Rect: TRect;
    DataCol: Integer; Column: TColumn;
    State: TGridDrawState);
if Table1.FieldByName('Salary').AsCurrency>36000 then
  (Rect, DataCol, Column, State);

If an employee's salary is greater than 36 thousand, its row is displayed in White.

Gokulan Ethiraj
Old March 30th, 2005, 03:42 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts

I have to compare with two fields like (updated date,registered date).This two fields contains dates. I have to check the values of these two fields,if registered date is greater than updated date,that row must become red in color.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date <= change row color mateenmohd Classic ASP Basics 0 August 1st, 2007 06:39 AM
how can i change row color in datagrid? berzegerol VS.NET 2002/2003 3 October 31st, 2006 09:08 AM
datagrid row color change berzegerol Visual Studio 2005 0 October 18th, 2006 06:33 AM
change the color of a row in a Datagrid bimal General .NET 1 October 6th, 2004 03:12 PM
changing datagrid row color msrnivas Classic ASP Components 4 August 5th, 2004 10:58 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.