Hi Guys,
Im trying out the ListView In VB2005
I want to change the font colour of the data being loaded depending on the value of one of the fields in the database.
I did this in VB6 but am not quite getting it here, can some one point me in the right direction.
Here is what Im trying just now
Im trying out the ListView In VB2005
I want to change the font colour of the data being loaded depending on the value of one of the fields in the database.
I did this in VB6 but am not quite getting it here, can some one point me in the right direction.
Here is what Im trying just now
Code:
'---Populate the ListView
Dim dRow As DataRow
For Each dRow In objDataSet.Tables(0).Rows
Dim itemX As ListViewItem = New ListViewItem(dRow(1).ToString & "" & dRow(2).ToString)
itemX.SubItems.Add(dRow(0))
If dRow(1).ToString = "" Then
itemX.SubItems.Item(1).ForeColor = Color.Black
Else
itemX.SubItems.Item(1).ForeColor = Color.Red
End If
lvResults1.Items.Add(itemX)
Next
[code]
Thanks again
Sb