troubleshooting Question

Change the color of a row in datagrid when certain column is not blank

Avatar of Richard Kreidl
Richard KreidlFlag for United States of America asked on
Visual Basic.NET
15 Comments1 Solution343 ViewsLast Modified:
I have the following code that 's giving me the following error when I run it. I attached a screen print of the errror.

As you can see in the screen print it says: Column Named Vacation_On cannot be found.

Which doesn't make sense, because the column exists in my Access database and I can see it in the datagridview.

Any ideas what's causing the error??


For Each row As DataGridViewRow In Me.DataGridView1.Rows
            If row.Cells("Vacation_On").Value Is DBNull.Value Then
                row.DefaultCellStyle.BackColor = Color.White
                row.DefaultCellStyle.BackColor = Color.Aqua
            End If

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros