0% found this document useful (0 votes)
169 views1 page

Coding Timer and Color Change

This document contains code for 3 different visual basic applications: 1) An electronic clock that displays the current time in seconds on a label, 2) A label that changes color every second when a timer is enabled, and 3) Three buttons that each change the background color of a button to red, green, or blue respectively when clicked.

Uploaded by

Alivia Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views1 page

Coding Timer and Color Change

This document contains code for 3 different visual basic applications: 1) An electronic clock that displays the current time in seconds on a label, 2) A label that changes color every second when a timer is enabled, and 3) Three buttons that each change the background color of a button to red, green, or blue respectively when clicked.

Uploaded by

Alivia Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Electronic Clock to display time in seconds

public Sub Timer_Timer()


Label.Text=Str(Now())
End
----------------------------------------------------
Color change every second of a text.

public Sub Button1_Click()


Timer1.Enabled=True
End
Public Sub Timer1_Timer()
Dim t1,t2,t3 As Integer
t1=Int(Rnd*255)
t2=Int(Rnd*155)
t3=Int(Rnd*55)
Label1.Foreground=Color.RGB(t1,t2,t3)
End
----------------------------------------------------
Button change Color

Public Sub Button1_Click()


assign3.Background=Color.Red
End
Public Sub Button2_Click()
assign3.Background=Color.Green
End
Public Sub Button3_Click()
assign3.Background=Color.Blue
End

You might also like