Solved

Timer not works!!

Posted on 2009-03-29
11
172 Views
Last Modified: 2012-05-06
Hi,

In VB6.
This is very strange, after form loaded, the timer1 wont be fired until I click button1.

Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
End Sub

Private Sub Command1_Click()
Timer1.Enabled = False
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Label2 = Now
End Sub
0
Comment
Question by:markdot
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 24013055
Try to change to this
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
End Sub

Open in new window

0
 

Author Comment

by:markdot
ID: 24013151
haha, I tried what you suggested and got no difference.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 24013157
and what about this:

Private Sub Form_Load()
  Timer1.Enabled = False
  Timer1.Interval = 100
  Timer1.Enabled = True
End Sub

Open in new window

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 48

Expert Comment

by:jpaulino
ID: 24013183
Have you starting the timer in other event ?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24013966
FYI, it worked for me without the need to restart the timer. (VB6, SP6 under W2000, SP4).

It may be a version thing, or your project/form may be corrupt. See if the same thing happens with a new project.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24014086
For me to GrahamSkan
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24014095
I guess it's greetings from Portugal :)
Hello
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24014221
if the timer is enabled at design time, it won't work (at least it does not for me).
if the timer is disabled at design time, it works without the line .enabled = false.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24014335
That might be the difference. In design mode it is enabled by default, so it doesn't occur to me that a programmer would change that setting and then be surprised at the effect.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24014395
Actually, I now see that it in the user's project the control is enabled in the Form_Load event, so I am as mystified as before.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24014784
>>  guess it's greetings from Portugal :)
Yes, you're "close" ... UK is one hour flight :P
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

786 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