Solved

Simpe simple Ms-Word Visual Basic Animation

Posted on 2000-03-27
8
250 Views
Last Modified: 2013-11-25
This is hardly even animation.

Say I have a form, "frmFormTitlePage".
Say I have a label on that form, "lblTitle"

I would like to have the text on lblTitle.caption to change colors every other second.  I've tried doing this numerous times by using a TIMER but I can't seem to get it right.  I know the color codes (RGB etc..) so it's not a problem in that area.  Ideas?

-rick, detroit
0
Comment
Question by:saksafon
8 Comments
 
LVL 3

Expert Comment

by:Lewy
ID: 2661387
Do you have a DoEvents after changing the color?
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2661389
You are most likely not refreshing the control after you change the color... try this...

Add a label called "Label1" to a new project.

Add a Timer called "Timer1" to the project.

Set Timer1's Interval property to 2000 and Enabled property to TRUE.

Put the following code in the Timer1 event:

Private Sub Timer1_Timer()
    Dim iVal As Integer
    iVal = Val(Label1.Tag)
    iVal = iVal - 1
    If iVal = -1 Then iVal = 15
    Label1.ForeColor = QBColor(iVal)
    Label1.Refresh
    Label1.Tag = CStr(iVal)
End Sub

Run the program... This is just an example of changing the label's color... It runs through all 16 QBColors...


Cheers!®©

0
 
LVL 14

Expert Comment

by:mcrider
ID: 2661401
Lewy, You don't need to use doevents... It's a dangerous call that can get you into alot of trouble if you don't use it properly...


Cheers!®©
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:saksafon
ID: 2661426
"Add a Timer called "Timer1" to the project.
Set Timer1's Interval property to 2000 and Enabled property to TRUE. "

Is this a VB thing?  I'm using Word VB and I don't know if I have access to this.  Where would I find a timer and how would I place it and change settings?  I'll keep looking but I don't know if I have the ability to add one.. hmm!

rick


0
 
LVL 3

Expert Comment

by:SirNick
ID: 2661515
In the past the way I have done this is

Private sub timer1_timer()
   lbltitle.forecolor = qbcolor(rnd*15)
end sub

I hope this helps..
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 50 total points
ID: 2662017
To get a timer on your form:

Right Click on your toolbar, and choose "Additional Controls".  Scroll down until you find the Timer Object reference, then click the check box next to it.  Click OK.

Your toolbar now has a clock-like object on it.  Select it, and draw it on your form.

In the Properties of the timer control, change the Interval property to the number of milliseconds between times you want it to run (1000 ms = 1 second).

Set Visible to false, and Enabled to true.

Double click the timer control, and you should get the _Timer event code block (probably IETimer1_Timer().  Put your color changing code in there.

Now, when you have the form up, every second, the IETimer1_Timer code will be executed, changing the color of the text.
0
 

Author Comment

by:saksafon
ID: 2663857
Adjusted points from 30 to 50
0
 

Author Comment

by:saksafon
ID: 2663859
Wow.. I didn't even know "additional controls" existed.  'ah I'm just a hack.

Thanks

rick
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Access Search and Replace Using VBA 6 73
Need more details 5 153
Please explain "Multi-Tenant Services" 5 89
Advice in Xamarin 21 80
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question