Listview forecolor

Roxbury

Newcomer
Joined
Jul 4, 2006
Messages
3
If the user that is put into the listview is Roxbury or Roxbury22 then I need the text to be red, however, it is remaining the default white...Can anyone help me here?

Code:
ListView1.Items.Clear()

        Dim I As Integer
        For I = 1 To users.Length - 1
            ListView1.Items.Add(users(I))

            If ListView1.Items(I).Text = "Roxbury" Or "Roxbury22" Then
                ListView1.Items(I).ForeColor = Color.Red
            End If
        Next
 
Whether .Net 2.0 is different I don't know, but in 1.1 at least the following code will not run because "Roxbury22" can't be cast to a boolean.
Visual Basic:
      If ListView1.Items(I).Text = "Roxbury" Or "Roxbury22" Then
                ListView1.Items(I).ForeColor = Color.Red
            End If

The following code works for me...
Visual Basic:
      If ListView1.Items(I).Text = "Roxbury" Or ListView1.Items(I).Text ="Roxbury22" Then
                ListView1.Items(I).ForeColor = Color.Red
            End If
 
Back
Top