views:

208

answers:

1

I have a DataGridView bound to a BindingSource. Each row has three fields: Name, StartDate, EndDate. Elsewhere on my form, I have a DateTimePicker control.

When the DateTimePicker's date is between a row's start and end dates, I want to highlight that row. But I cannot figure out how to do this. Can anyone give me a starting point?

A: 

Do you want to highlight all of the rows that meet the condition?

You can go through row by row to see which rows satisfy the condition each time the DTP value changes.

Then, for each cell in these rows, change DataGridViewCell.Style however you want to highlight the rows. For each cell that is in a row that doesn't satisfy the constraint, set DataGridViewCell.Style to the default.

John at CashCommons