hi,can anyone help me with a code that can change form color after 10 seconds ,for example from yellow to red continiously.please help.

Recommended Answers

All 2 Replies

hi,can anyone help me with a code that can change form color after 10 seconds ,for example from yellow to red continiously.please help.

Hi
U can use Timer for this. Timer has interval property, which Specifies the number of milliseconds between calls to a Timer control's Timer event and Form.Backcolor property used to change the form color

Draw a Timer control and set its interval to 10000 (10 secs)
Use Form1.BackColor = vbRed This just change the BackColor to Red
Declare a boolean variable "flag" in Form Level (Top of the form) dim flag as boolean In the Timer1_Timer event Try the following
check flag variable , if it is false,
then Form1.BackColor = vbRed and make flag to true
else Form1.BackColor = vbYellow and make flag to false

try to use this

me.backcolor=rgb(rnd*255,rnd*255,rnd*255)

and call this on a timer .
set the timer interval as desired.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.