PDA

Click to See Complete Forum and Search --> : What is wrong with this code?


kourosh
Nov 15th, 1999, 07:19 AM
hi, I want to generate form1.backcolor every 1 second so I have used the timer but I can't get this code to work can anybody help.
=============================================

Private Sub Timer1_Timer()
Randomize
Dim Blue As Integer
Dim Red As Integer
Dim Green As Integer
Blue = Int((1 - 85 + 1) * Rnd + 1)
Red = Int((1 - 85 + 1) * Rnd + 1)
Green = Int((1 - 85 + 1) * Rnd + 1)
Form1.BackColor = RGB(Red, Green, Blue)
End Sub
=============================================
Thanks alot.
:) :)

jpark
Nov 15th, 1999, 07:31 AM
Hi,

Set the Interval property of Timer1 to 1000


Blue = Int((255) * Rnd + 1)
Red = Int((255) * Rnd + 1)
Green = Int((255) * Rnd + 1)

Form1.BackColor = RGB(Red, Green, Blue)

Maybe there are better ways, but this works.

Joon

[This message has been edited by jpark (edited 11-15-1999).]