Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Using Timer()


Message #1 by "charles baldo" <charlesbaldo@h...> on Tue, 26 Mar 2002 20:14:14
Hey, you should tell us whether you are working on a Windows Application 
or Web Application.

For a Windows Application, the Timer control works like the one in VB6, so 
no one should have problem with that (because I tried it before).

For a Web Application, it is a totally different story, as the Timer 
Control doesn't work at all!!!
Therefore, here I suggest 3 ways that you can use instead.

1. Use the Timer control in a Windows Application instead.

2a. In a Web Application's Web Form, you can use client-side JavaScript on 
the page in an (tiny/almost hidden)IFrame to refresh the page in the 
IFrame every hour.
e.g.
<script language=javascript>
setTimeout('location.reload()',3600000)
</script>

2b. or place the following code between the <HEAD> & </HEAD> tags. 
<META HTTP-EQUIV="refresh" content="3600; URL=[name of you form].aspx">
which can also refresh the page in the IFrame every hour.

Of course, in the Page_Load event of the page that is to be refreshed, you 
must place those code (previously in you Timer function).

3. You could create a service that uses a Timer to periodically send email.
(Server-based timer is an update of the traditional timer that has been 
optimized to run in a server environment.)


Previous message:
> Could anyone direct me to some code to use the Timer() function. 
I>  want to send an email every hour and am have trouble 

> I tried something like this

>    i = 1
 >   Do While i=1 ' do it forever
 >     t = Timer()+600
 >     Do While t >Timer()
 >       ' do email send function
 >     Loop
 >   Loop

> but timer() never updates.

> Any suggestions?
T> hank You
C> huck 

  Return to Index