Results 1 to 2 of 2

Thread: What is wrong with this code?

  1. #1

    Thread Starter
    Hyperactive Member kourosh's Avatar
    Join Date
    Aug 1999
    Location
    Vancouver, British Columbia, Canada
    Posts
    256

    Post

    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.

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Garden Grove, CA, Orange
    Posts
    55

    Post

    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).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width