How to let TextBox display in different color and blink?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, everyone, I have a form with a TextBox to display my calculation result and CmdButton and something else. How can I let the calculation result display in different color and blink according to different criteria? The followinf codes are in my CmdButton.

Dim intTest As Integer
..
Calculutaion process
..
If intTest = 0 Then
Display intTest in blue
Else
Display intTest in red and blink
End IF

Me![TextBox] = intTest

End Sub

Thanks in advance
 
Jeff said:
Hi, everyone, I have a form with a TextBox to display my calculation result
and CmdButton and something else. How can I let the calculation result display
in different color and blink according to different criteria? The followinf
codes are in my CmdButton.
Dim intTest As Integer
.
Calculutaion process
.
If intTest = 0 Then
Display intTest in blue
Else
Display intTest in red and blink
End IF

Me![TextBox] = intTest

End Sub



If intTest = 0 Then
Me![TextBox].ForeColor = vbBlue
Me![TextBox].Visible = True
Me.TimerInterval = 0
Else
Me![TextBox].ForeColor = vbRed
Me.TimerInterval = 500
End IF


In your Timer event code...

Me![TextBox].Visible = Not Me![TextBox].Visible
 
Thank you very much for your help, Rick. I have tested the code you told me, but there are still some problems.

Actually I have about 50 such TextBoxes in my Form, and I put your code to the first and second one for testing. When the result for the first one is not "0" and the second one is "0", both won't blink (font color is ok). When the result for the first one is "0" and the second one is not "0", both blink. Why?

I have background color for my TextBoxes. When it blinks, the whole TextBox blinks. Can I just let the digits blink and the background stays still? Thank you.

Jeff


"Rick Brandt" 來函:
Jeff said:
Hi, everyone, I have a form with a TextBox to display my calculation result
and CmdButton and something else. How can I let the calculation result display
in different color and blink according to different criteria? The followinf
codes are in my CmdButton.
Dim intTest As Integer
.
Calculutaion process
.
If intTest = 0 Then
Display intTest in blue
Else
Display intTest in red and blink
End IF

Me![TextBox] = intTest

End Sub



If intTest = 0 Then
Me![TextBox].ForeColor = vbBlue
Me![TextBox].Visible = True
Me.TimerInterval = 0
Else
Me![TextBox].ForeColor = vbRed
Me.TimerInterval = 500
End IF


In your Timer event code...

Me![TextBox].Visible = Not Me![TextBox].Visible
 
Back
Top