Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Sunday, June 5, 2011

VB-17 : Colour changing using Timer


Refer Changing Color as per the entered Number also.


(A)        When we give 2000 as intervals for the first and second timer, the 2 timers will work in each 2 seconds by changing the text color in the textbo


A)   Property :


         Timer : NAME-Timer1, INTERVAL-2000
         Timer : NAME-Timer2, INTERVAL-2000
        Textbox : NAME-Text1, TEXT-Hai




B)  Attaching Code to the Object :

  
            Private Sub Timer1_Timer()
           Text1.ForeColor = &HFF0000
           End Sub

           Private Sub Timer2_Timer()
           Text1.ForeColor = 255
          End Sub



Note that &HFF0000 and 255 are the code of the colours taken from the forecolor in colour palette.

========================================================================

(B)        The same program using one timer only.(If we don’t know the first given colour)

     A)     Property :
       

   Timer : NAME-Timer1, INTERVAL-2000
   Textbox : NAME-Text1, TEXT-Hai


       

    B)   Attaching Code to the Object :
     
         
           Dim flag As Integer
          Private Sub Timer1_Timer()
       If flag = 1 Then
     Text1.ForeColor = &HFF&
    flag = 0
     Else
     Text1.ForeColor = &HC00000
      flag = 1
    End If
    End Sub

Note that &HFF&and &HC00000 are the code of the colours taken from the forecolor in colour palette.

  Back to Home   &  VB

No comments: