I have a DataGridView on one of my forms. I populate the contents of that DGV with the following code:
What I'm wanting to do is to set the background color to Yellow if the "TicketPriority" is equal to a certain string (like "Critical"), but I'm not sure how to do that.
Any ideas?
VB.NET:
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = maintenance.mdb"
con.Open()
sql = "Select ID AS TicketNumber, shortDesc AS TicketDescription, techName AS AssignedTechnician, depName AS Department, Created AS DateOpened, lastUpdate AS LastUpdated, dueDate AS DateDue, prioName AS TicketPriority From Problem WHERE StatName <> 'Closed'"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Problem")
con.Close()
If ds.Tables("Problem").Rows.Count > 0 Then
With dgvOpen
.DataSource = ds.Tables("Problem")
End With
End If
What I'm wanting to do is to set the background color to Yellow if the "TicketPriority" is equal to a certain string (like "Critical"), but I'm not sure how to do that.
Any ideas?