Using Cases to change background colour | Visual Studio 2008

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2010-03-18T09:39:44Z Indexed on 2010/03/18 9:41 UTC
Read the original article Hit count: 254

I really need help working with cases, I'm only learning it so far, but just can't get a drop down menu to work that would change the background of a Textbox.

Private Sub cbColours_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbColours.SelectedIndexChanged
    Select Case colours

        Case Is = "Red"
            txtSpace.BackColor = Color.Red

        Case Is = "Blue"
            txtSpace.BackColor = Color.Blue

        Case Is = "Green"
            txtSpace.BackColor = Color.Green

    End Select
End Sub

It isn't doing anything at all...

In the dropdown menu, it has

Red, Blue and Green one per line

When the value (e.g. Green) is clicked, it will then change the Textbox to the colour selected.

Many help appreciated :)

© Stack Overflow or respective owner

Related posts about visual-studio-2008

Related posts about programming-languages