Question change color

Dimuthu93

Member
Joined
Oct 18, 2009
Messages
13
Programming Experience
Beginner
right, i wanted to create a simple program, a random number generator that determines your "luck" today in a windows browser application so that i can view it on internet explorer, the idea was that if your luck was above 50% then the text would be green otherwise red here is my code

VB.NET:
    Private Sub btnLuck_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnLuck.Click
        'check luck based upon upon luck so far
        lblluck.Content = FormatPercent(Rnd())
        btnLuck.IsEnabled = False
        MsgBox("Your luck is: " & lblluck.Content, MsgBoxStyle.Information, "Luck")
        lblWord.Visibility = Windows.Visibility.Visible

        If lblluck.Content > 50 Then
            lblluck.Foreground = Colors.Green
        ElseIf lblluck.Content < 50 Then
            lblluck.Foreground = Colors.Red
        End If
    End Sub

    Private Sub btnRetry_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnRetry.Click
        'Re-enables luck button
        lblluck.Content = FormatPercent(Rnd())
        MsgBox("Your luck is: " & lblluck.Content & "However you just clicked the retry button, therefore your luck is void", MsgBoxStyle.Information, "Luck")
    End Sub

seems alright huh?
well no, both "colors.green" and "colors.red" are underlined

any ideas?
Dimuthu
 
Back
Top