Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have DataGridView, with three columns: Item Name, DateTime of Beginning of Auction, DateTime of closing of Auction (which is 5 minutes after the first DateTime).
I want to check if the time of closing expired and if it is expired, to change color of the that row. Aslo, if there is suggestion how to add countdown time for each row.
Thank you in advance

What I have tried:

Tried to find DataGridView property which handle this
Posted
Updated 20-Jun-19 21:17pm

1 solution

Start with the DataGridView.RowPrePaint[^] event: it is called for row just before it is drawn. In it, check the expiry and set the foreground / background colours appropriately.

You will also need a Timer to Invalidate the DGV so that it does get repainted.

To set a "countdown timer" for each row, use the same event and timer, and update the row "countdown" column.
 
Share this answer
 
Comments
Sinisa Janjetovic 21-Jun-19 3:34am    
Thank you, unfortunately I can not find it in Properties for DataGridView
OriginalGriff 21-Jun-19 3:37am    
It's an Event, not a property.
Properties are for data, Events are for action as a result of things happening ... Look at the properties pane and click the little lightning bolt.
Sinisa Janjetovic 21-Jun-19 3:47am    
I did, but there is no event RowPrePaint
Maciej Los 21-Jun-19 3:55am    
Take a deeper look. If this event is available in MSDN documentation, then it should be available in your project, unless it isn't a WinForm project.
OriginalGriff 21-Jun-19 3:57am    
What events can you see?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900