Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • 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
 
jpaulinoCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jpaulinoCommented:
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
 
jpaulinoCommented:
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
 
jpaulinoCommented:
>>  guess it's greetings from Portugal :)
Yes, you're "close" ... UK is one hour flight :P
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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