Change color on value

Here's what I have but it does not work, what am I doing wrong?

Select Case ProgressBar1.Value
Case Is < 40
ProgressBar1.ForeColor = Color.Red
Case Is < 60
ProgressBar1.ForeColor = Color.Aqua
Case Is <= 94
ProgressBar1.ForeColor = Color.Blue
Case 95 To 100
ProgressBar1.ForeColor = Color.Green
End Select

[361 byte] By [Whoisit] at [2007-12-22]
# 1
The code works fine with me and there aren't any errors, but where did you put it?
MoayadMardini at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
Thanks for the reply Moayad,
Here's the full sub
Private Sub BtnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTest.Click
'Just check that a password has been entered
Call Checkforpass()

'Function KeyQuality checks strength of password entered
Me.ProgressBar1.Value = KeyQuality(Me.TxtPass.Text)
LblPercent.Text = ("Password Strength = ") & Me.ProgressBar1.Value & (" %")

Select Case ProgressBar1.Value
Case Is < 40
ProgressBar1.ForeColor = Color.Red
LblStrength.Text = "Poor"
Case Is < 60
ProgressBar1.ForeColor = Color.Aqua
LblStrength.Text = "Average"
Case Is <= 94
ProgressBar1.ForeColor = Color.Blue
LblStrength.Text = "Good"
Case 95 To 100
ProgressBar1.ForeColor = Color.Green
LblStrength.Text = "Excellent"

End Select
LblPercent.Visible = True

End Sub

Whoisit at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3
Okay, that's great :)
Another question, why the code doesn't work, what heppen exactly? and are you sure that KeyQuality function works fine?
MoayadMardini at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4
Yes, Key function works exactly as it should
What happens is the colour of the progress bar is always Green.
Whoisit at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5
I don't believe you can change the 'block' color on a progress bar since they are some kind of graphic, or drawn internally. This is designed so that applications maintain a uniform appearance on the operating system. You would have to draw your own progress bar if you want it to change color.
SJWhiteley at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 6
For future reference I've found out that, if you use the XP Theme progress bar stays Green, but if you change to the Classic Theme then the color changes to what ever forecolor you want, crazy or what?
Whoisit at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic General...