Solved

Timer not works!!

Posted on 2009-03-29
11
175 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 143

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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 143

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Put text in a picture ASP.NET C# 2 61
Sorting multiple rows and columns, and count duplicates in Excel 2013 4 87
vbModal 12 57
adding "ungroup sheets" to existing vbs code 5 31
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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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