PDA

View Full Version : Change color of text



The"Truth"
11-25-2008, 09:18 AM
I want the Caption Fail to be displayed in Red, and the Caption Pass to be displayed in Green. Is this possible?



If (ResultLabel1.Caption = "FAIL" Or ResultLabel2.Caption = "FAIL" Or
... ResultLabel10.Caption = "FAIL" Then
PassorFailLabel.Caption = "FAIL"
ElseIf (ResultLabel1.Caption = "Pass" And ... ResultLabel10.Caption = "Pass" Then
PassorFailLabel.Caption = "Pass"
End If

Kenneth Hobs
11-25-2008, 09:35 AM
Private Sub CommandButton1_Click()
PassOrFailLabel.Caption = "Pass"
If PassOrFailLabel.Caption = "Pass" Then
PassOrFailLabel.ForeColor = &H8000&
Else
PassOrFailLabel.ForeColor = &HFF&
End If
End Sub

Private Sub CommandButton2_Click()
PassOrFailLabel.Caption = "Fail"
If PassOrFailLabel.Caption = "Pass" Then
PassOrFailLabel.ForeColor = &H8000&
Else
PassOrFailLabel.ForeColor = &HFF&
End If
End Sub

Bob Phillips
11-25-2008, 09:47 AM
Why not use conditional formatting?