473,379 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Timer

52
hi,
im trying to call the form load after each 5 seconds. can enyone please look at my code and show me how to load the form after 5 seconds. thank you
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. lbl.Caption = "30"
  3. End Sub
  4.  
  5. Private Sub Timer1_Timer()
  6.  
  7.      If lbl.Caption = 0 Then
  8.           Timer1.Enabled = False
  9.           MsgBox ("100 secs is up")
  10.      Else
  11.           lbl.Caption = lbl.Caption - 1
  12.      End If
  13.      If lbl.Caption = lbl.Caption ' And i dont know the rest
  14.      Random
  15.      End If
  16. End Sub
  17.  
  18. Public Sub Random()
  19. Randomize
  20. Label4.Caption = Int(Rnd * 10)
  21. End Sub
  22.  
Plese help...
Feb 28 '08 #1
4 992
debasisdas
8,127 Expert 4TB
Tell me what exactly you are trying to do .

Why you need to load the form every 5 seconds ?
Feb 28 '08 #2
VBWheaties
145 100+
I assume you mean you need to delay the visibility of the form for 5 seconds?

Try this in your forms load event:
Expand|Select|Wrap|Line Numbers
  1. System.Threading.Thread.Sleep(5000) ' 5 seconds
  2.  
Feb 28 '08 #3
Killer42
8,435 Expert 8TB
System.Threading.Thread.Sleep(5000) ' 5 seconds
The original post looks to me like VB6 code, in which case this won't work as posted.

THEAF, if you mean that you want the timer to load the form that it's on, this is impossible. Since the timer control exists within the form, it doesn't exist except while the form is loaded. It therefore cannot load that form. When the form is unloaded, no more timer.

Are you sure you don't want to unload the form? Or do you want to load a different form, or what?
Feb 29 '08 #4
THEAF
52
sorry,
what it was, was that as the each 5 sec the public sub.. should be called to randomize a new number but it's ok now.
Mar 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
2
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: ...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
8
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
8
by: =?Utf-8?B?RGF2ZSBCb29rZXI=?= | last post by:
I have a Timer that I set to go off once a day, but it frequently fails! In order to debug I would like to be able to check, at any moment, whether the Timer is enabled and when it will next...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.