|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
||||
|
||||
|
I need to make the text on a command button change colors to grab the users attention.
I have tried using if then else statements and For next loops but am not having much success. What I want the code to do is make the text change colors every second. ----------Example code--------------- Dim intTime As Integer Command194.Visible = True Command194.SetFocus For intTime = 10000 to 1 Step -1 If intTime =< 10000 Then Command194.ForeColor = 2535 ElseIf intTime =< 9000 Then Command194.ForeColor = 0 ElseIf intTime =< 8000 Then Command194.ForeColor =2535 ElseIf intTime =< 7000 Then Command194.ForeColor = 0 ElseIf intTime =< 6000 Then Command194.ForeColor = 2535 ElseIf intTime =< 5000 Then Command194.ForeColor = 0 ElseIf intTime =< 4000 Then Command194.ForeColor = 2535 ElseIF intTime =< 3000 Then Command194.ForeColor = 0 ElseIf intTime =< 2000 Then Command194.ForeColor = 2535 ElseIf intTime =< 1000 Then Command194.ForeColor = 0 ElseIf intTime =< 1 Then End If Next intTime ------------------------------------ From what I understand, the computer counts in milliseconds meaning the value 1000 = 1 second. What I'm trying to do is get the computer to count down from 10000 (i.e. 10 seconds) and alternate the text color from black to red simulating a flashing appearance. The interval between the color changes should be one second. I haven't programmed in 20 years and am pretty lost when it comes to VBA. It's a lot like Basic and yet Not like Basic. Anybody got a moment to explain what I'm doing wrong? |
|
#2
|
||||
|
||||
|
I made two pictures in Paint of the text I wanted displayed one in red one in blue . I then used used them as pictures for the command button and had it cycle back and forth between them. It was kind of the long way around but it worked great.
SubForm Load() Me.TimerInterval = 1000 End Sub SubForm Timer() Static intflash As Integer If intflash Then Me!CmdBtnName.Picture = "AddressandNameofPicture # 1 toDisplay" Else Me!CmdBtnName.Picture = "AddressandNameofPicture # 2 toDisplay" End If intflash = Not intflash End Sub This code cycles between picture one and picture two every second giving the appearance that the text is flashing. ---------------------------------------- Quote:
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Make text flash different colors using vba |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|