I am displaying in a TEXT-BOX a field from one of my databases. I know how to
change the property of the text-box to display the text in different colors. But
what I want is that when the text is (Let's say positive it is in black and when
it is a negative it will display red). Can you help me on this matter?
Once again thanks for all your help and insight. David M. Camp
Answer by Martin Allen:
Is this just a normal TextBox you are talking about? If it is, then you
can do it with this code:
Private Sub Text1_Change()
If IsNumeric(Text1.Text) = False
Then
Text1.ForeColor = RGB(255, 0, 0) 'If
code is not numeric, set it to red
Exit Sub
End If
If Text1.Text >= 0 Then
Text1.ForeColor = &H80000008 'If
text is greater than or equal to zero, then set to default text colour
Else
Text1.ForeColor = RGB(255, 0, 0) 'If text is less than
zero, set to red
End If
End Sub