• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Timer not works!!

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
markdot
Asked:
markdot
  • 4
  • 4
  • 2
  • +1
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
Try to change to this
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
End Sub

Open in new window

0
 
markdotAuthor Commented:
haha, I tried what you suggested and got no difference.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
and what about this:

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

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Jorge PaulinoIT Pro/DeveloperCommented:
Have you starting the timer in other event ?
0
 
GrahamSkanRetiredCommented:
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
 
Jorge PaulinoIT Pro/DeveloperCommented:
For me to GrahamSkan
0
 
GrahamSkanRetiredCommented:
I guess it's greetings from Portugal :)
Hello
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
GrahamSkanRetiredCommented:
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
 
GrahamSkanRetiredCommented:
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
 
Jorge PaulinoIT Pro/DeveloperCommented:
>>  guess it's greetings from Portugal :)
Yes, you're "close" ... UK is one hour flight :P
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now