adding a little glamor

Can anyone tell me how I could go about a certain process. The problem at hand is that I have a program that takes some time to finish its task so during this process I want a word on the form to blink two different colors until the process has stopped. anybody got any ideas?

Comments

[b][red]This message was edited by doofusboy at 2003-8-15 5:1:42[/red][/b][hr]: Can anyone tell me how I could go about a certain process. The problem at hand is that I have a program that takes some time to finish its task so during this process I want a word on the form to blink two different colors until the process has stopped. anybody got any ideas?: : -Einstein3000: Assuming the "word on the form" is in a Label control, just change its .ForeColor property back and forth between two colors and use a Timer control to control this process and how long it runs. You'll probably need to add a 'DoEvents' to the other task in your code to allow the timer to do its thing simultaneously.

Set the Timer interval to whatever you want (in milliseconds so if you want the color to change every second you would set the value to 1000). Then make sure you set the Enabled value to False so it doesn't start running when the program starts up. When you want the label to appear and start blinking add in this code:[code]Private Sub Form_Load() lblWorking.ForeColor = vbRed '//makes the font red lblWorking.Visible = True '//makes the label visible tmrColorChange.Enabled = True '//starts the timer ..start your code DoEvents '//allows windows to process other actions in a loop '//when your code finishes, add the following lblWorking.Visible = False tmrColorChange.Enabled = FalseEnd Sub[/code]And the code for the timer should look something like:[code]Private Sub tmrColorChange_Timer() If lblWorking.ForeColor = vbRed Then lblWorking.ForeColor = vbGreen '//makes the font green Else lblWorking.ForeColor = vbRed '//if the font isn't red it '//will be changed to red End IfEnd Sub[/code]That should do it. If you have any questions, go ahead and drop me a line.[code] [b]..:[/b] Zantos [b]:..[/b] [blue]Mega[/blue][red]Riot[/red] Productionshttp://www.megariot.funurl.com[/code]