FOLKS:
I fill my data grid view with data and i try to color a few cells based on a condition but nothing seems to work..no errors either..can u pls help me >?
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim con As OleDbConnection = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\bashkark\Desktop\Final Database.mdb")
con.Open()
Dim cmd As New OleDbCommand
cmd = New OleDbCommand("SELECT * from table2", con)
Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Try
Dim ds As DataSet = New DataSet()
da.Fill(ds, "table2")
DataGridView1.DataSource = ds.Tables("table2").DefaultView
For Each r As DataGridViewRow In DataGridView1.Rows
If r.IsNewRow = False AndAlso Not TypeOf (r.Cells("MFG").Value) Is DBNull Then
Select Case r.Cells("MFG").Value.ToString.ToUpper
Case "DELL", "HP"
r.Cells("MFG").Style.BackColor = Color.Green
End Select
End If
Next
Finally
con.Close()
cmd = Nothing
da.Dispose()
con.Dispose()
End Try
con.Close()
cmd = Nothing
con.Dispose()
End Sub