Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
7
Answers
Cell color not changing based on condition..
Mohammad Imran
7y
226
1
Reply
Below code is not working.not changing color.. data type is datetime..
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 6)
{
var mydatetime = DateTime.Parse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
if (mydatetime.Hour > 9 && mydatetime.Minute > 30)
{
e.CellStyle.BackColor = Color.Yellow;
}
}
}
Post
Reset
Cancel
Answers (
7
)
Next Recommended Forum
Check 3D rectangle intersection
add value on 0th index when combo box is binded with db