Hi,
Is there a way to execute a function after 1 minute on server-side once a
web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed 6 1549
Salam
Work with "Timer" on the server side and Excute the function when the timer
complete 1 Min, and then reset it
--
ALI RAZA SHAIKH
MCAD.net www.programmersparadise.cjb.net
alirazashaikh.b logspot.com
"Yama" <ya**@yamabiz.c om> wrote in message
news:OZ******** ******@tk2msftn gp13.phx.gbl... Hi,
Is there a way to execute a function after 1 minute on server-side once a web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed
In your page class, create a method that calls
Thread.Sleep(Ti meSpan.FromMinu tes(1)) and then executes some code. Create a
new thread to call that method. It will cause the thread in which the method
is running to sleep, not the main thread.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"Yama" <ya**@yamabiz.c om> wrote in message
news:OZ******** ******@tk2msftn gp13.phx.gbl... Hi,
Is there a way to execute a function after 1 minute on server-side once a web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed
BTW, I should mention that using a timer would be a waste. Timers are only
useful if you want to repeat something at intervals.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OE******** ******@TK2MSFTN GP14.phx.gbl... In your page class, create a method that calls Thread.Sleep(Ti meSpan.FromMinu tes(1)) and then executes some code. Create a new thread to call that method. It will cause the thread in which the method is running to sleep, not the main thread.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer Ambiguity has a certain quality to it.
"Yama" <ya**@yamabiz.c om> wrote in message news:OZ******** ******@tk2msftn gp13.phx.gbl... Hi,
Is there a way to execute a function after 1 minute on server-side once a web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed
Kevin,
Let's say I have my page default.aspx that has render to client browser what
you are telling me is that I could use the Thread.Sleep static method. But
what event shall I tie a delegate to to fire this method?
Can you drop a quick code illustration?
Thanks,
~yamazed
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OE******** ******@TK2MSFTN GP14.phx.gbl... In your page class, create a method that calls Thread.Sleep(Ti meSpan.FromMinu tes(1)) and then executes some code. Create a new thread to call that method. It will cause the thread in which the method is running to sleep, not the main thread.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer Ambiguity has a certain quality to it.
"Yama" <ya**@yamabiz.c om> wrote in message news:OZ******** ******@tk2msftn gp13.phx.gbl... Hi,
Is there a way to execute a function after 1 minute on server-side once a web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed
How? In what page event?
"ALI RAZA" <al************ *@yahoo.com> wrote in message
news:eN******** ******@TK2MSFTN GP15.phx.gbl... Salam
Work with "Timer" on the server side and Excute the function when the timer complete 1 Min, and then reset it
-- ALI RAZA SHAIKH MCAD.net
www.programmersparadise.cjb.net alirazashaikh.b logspot.com
"Yama" <ya**@yamabiz.c om> wrote in message news:OZ******** ******@tk2msftn gp13.phx.gbl... Hi,
Is there a way to execute a function after 1 minute on server-side once a web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed
As you want to run it as soon before the page is sent to the client, create
an event handler for the PreRender event, and call your method that executes
the code from that event handler. Example:
private void InitializeCompo nent()
{
this.Load += new System.EventHan dler(this.Page_ Load);
this.PreRender +=new EventHandler(Pa ge1_PreRender);
}
private void Page1_PreRender (object sender, EventArgs e)
{
Thread myThread = new Thread(new ThreadStart(thi s.WaitAMinute)) ;
myThread.Start( );
}
private void WaitAMinute()
{
Thread.Sleep(Ti meSpan.FromMinu tes(1));
// Do Something
}
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
"Yama" <ya**@yamabiz.c om> wrote in message
news:eA******** ******@tk2msftn gp13.phx.gbl... Kevin,
Let's say I have my page default.aspx that has render to client browser what you are telling me is that I could use the Thread.Sleep static method. But what event shall I tie a delegate to to fire this method?
Can you drop a quick code illustration?
Thanks,
~yamazed
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message news:OE******** ******@TK2MSFTN GP14.phx.gbl... In your page class, create a method that calls Thread.Sleep(Ti meSpan.FromMinu tes(1)) and then executes some code. Create a new thread to call that method. It will cause the thread in which the method is running to sleep, not the main thread.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer Ambiguity has a certain quality to it.
"Yama" <ya**@yamabiz.c om> wrote in message news:OZ******** ******@tk2msftn gp13.phx.gbl... Hi,
Is there a way to execute a function after 1 minute on server-side once a web form is rendered? Can you please show me some code to illustrate this?
Thanks,
~yamazed
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark |
last post by:
Hello all,
I know why the following doesn't work ... I can't figure out how to make it
work like I want it to. Basically, I only want the loop computing
fibonacci numbers to run for approx 5 seconds. The timer fires, the
exception is raised, but it is not caught ... because the execution stack
for the function that raises isn't in the same thread as the try: except:.
How do you fix this? Is it better to do this without exceptions as...
|
by: laurenq uantrell |
last post by:
I have been using the following function to test the speed of various
functions, however, quite often the return value is zero.
I'm hoping someone can help improve on this.
Function TimeIt() As Single
On Error GoTo CodeErr
'PURPOSE: Times a process in seconds from start to finish
'USAGE: msgbox TimeIt
Dim sngStart As Single
|
by: theinvisibleGhost |
last post by:
I think I've found a bug in the timer control.
I've got a class which uses a timer control.
It imports it from System.Windows.Forms
This timer ticks once a second, and then updates a
label which represents a clock on a form, to which the original class
has a reference. (MVC style)
If the user clicks and holds the X button on the form
|
by: whtinkm |
last post by:
Hi, All
Recently, my project need some code like following:
using System;
using System.Threading;
namespace MyTimerTest
{
class Class1
{
|
by: Jim Hammond |
last post by:
The following code tries to excute a function 10 seconds after Page_Load by using a Timer, but the callback never gets called.
private void Page_Load(object sender, System.EventArgs e)
{
// Set timer to call Page_PostLoad in 10 seconds
| |
by: Jason Shohet |
last post by:
Lets say I want a button to execute 10 seconds after I press it, not
immediately.
Any ideas how to cause that, in a code-behind. IMO its only server side
code, I don't think javascript needs to get in to the equation (?)
|
by: UG |
last post by:
I just wanted to know whether any timer facility exists in C, as it is
not mentioned in K&R 2, or in the ISO Draft. By timer function i mean
that when we use standard input function like scanf() or getch() or
any other function, the interface stops to take input from user but
what if user doesn't give input for hours, the program will still be
waiting. Is there any way to circumvent the scanf() (or any other
input function for that matter)...
|
by: steveyjg |
last post by:
I'm trying to call a function that will pause execution for 30 seconds and have a counter timer counting to 30 seconds during this pause. When the counter hits 30 execution of the program will continue.
So far I have tried:
Public Function timeDelay()
timerCounter = 0 'global variable
Timer1.Enabled = True
End Function
|
by: Ollie Riches |
last post by:
I'm looking into a production issue related to a windows service and
System.Timers.Timer. The background is the windows service uses a
System.Timers.Timer to periodically poll a directory location on a
network for files and then copies these files to another location (on
the network) AND then updates a record in the database. The file
copying is performed before the database update because the file
system is not transactional.
The code...
|
by: Aads |
last post by:
Hi there,
I've two forms namely FormA & FormB whose constructors initialize some ActiveX controls (to display some default charts) & does some init tasks which are time consuming as shown in the below code snippet:
Dim theFormA As FormA = New FormA
Dim theFormB As FormB = New FormB
To optimize the program, I'm calling the above lines of code in two separate threads which are working absolutely fine....
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |