Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

 

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

Posted

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.

      If ListView1.Items(I).Text = "Roxbury" Or "Roxbury22" Then
               ListView1.Items(I).ForeColor = Color.Red
           End If

 

The following code works for me...

      If ListView1.Items(I).Text = "Roxbury" Or ListView1.Items(I).Text ="Roxbury22" Then
               ListView1.Items(I).ForeColor = Color.Red
           End If

Anybody looking for a graduate programmer (Midlands, England)?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...