R
Richard Wilde
I am trying to change a colour of a listbox item depending on a value in a
data view
My fields in the dataview are
ID
Name
idCat
ListBox1.ValueMember = "ID"
ListBox1.DataSource = dv1
ListBox1.DisplayMember = "Name"
I have set the listbox drawMode to OwnerdrawFixed and want to be able to
display the name in a different color depending on the idCat. This is where
i have run into problems. I cannot retrieve the idCat from any of the passed
in parameters... Can any one help?
DrawItem event...
dim idCat as int32
idCat = <<HERE>>
Select Case (e.Index)
Case 0
myBrush = Brushes.Red
Case 1
myBrush = Brushes.Orange
Case 2
myBrush = Brushes.Purple
End Select
draw...
data view
My fields in the dataview are
ID
Name
idCat
ListBox1.ValueMember = "ID"
ListBox1.DataSource = dv1
ListBox1.DisplayMember = "Name"
I have set the listbox drawMode to OwnerdrawFixed and want to be able to
display the name in a different color depending on the idCat. This is where
i have run into problems. I cannot retrieve the idCat from any of the passed
in parameters... Can any one help?
DrawItem event...
dim idCat as int32
idCat = <<HERE>>
Select Case (e.Index)
Case 0
myBrush = Brushes.Red
Case 1
myBrush = Brushes.Orange
Case 2
myBrush = Brushes.Purple
End Select
draw...