format Listview Items

  • Thread starter Thread starter thomasp
  • Start date Start date
T

thomasp

Can I format the items in a listview differently? Use different fonts and
colors for different item.
VB2005

Thanks,

Thomas
 
Yes you can. This control has a listitems property that lets you work with
the individual items.

Rgds, Phil
 
Can I format the items in a listview differently? Use different fonts and
colors for different item.
VB2005

Make sure the row's first item's 'UseItemStyleForSubItems' property is set
to 'False' when assigning different fonts and colors to sub items.
 
I used this, it seems to be doing what I want.

Dim x As Integer = 0
For Each dsColumn As DataColumn In ds.Tables(0).Columns
lstAvailable.Items.Add(dsColumn.ColumnName)
Select Case dsColumn.ColumnName
Case Is = "Db"
lstAvailable.Items(x).ForeColor = Color.Red
Case Is = "Velocity"
lstAvailable.Items(x).ForeColor = Color.Red
End Select

x += 1
Next
 
Back
Top