Solved

Timer not works!!

Posted on 2009-03-29
11
170 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now