.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Background Worker With Timer in C#.Net

Posted By: Narayanan     Posted Date: August 16, 2011    Points:5   Category :C#
Hi friends,
I am using Background worker and Timer in my Project.Where can i start timer in the Background worker?
Scenario:File Processing (send and received Concept)File Transfer from Source path to Designation path using Backgroundworker with Timer in C#.net.Please tell me .Thanks for your attention
Regards,
Lakshmi Narayanan.S






Responses
Author: Narayanan             
Posted Date: August 17, 2011     Points: 20   

Hi,
Thanks for your link


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Gowthammanju             
Posted Date: August 17, 2011     Points: 20   

try these coding as


create function named ss as

private void ss(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
int delay = 1000; // 1 second
while (!worker.CancellationPending)
{
do something
Thread.Sleep(delay);
}
e.Cancel = true;
}


then check whether it works r not by

int delay = 1000; // 1 second
int interval = 60000;
int elapsed = 0;
while (!worker.CancellationPending)
{
elapsed = 0;
do something
while (elapsed < interval && !worker.CancellationPending)
{
Thread.Sleep(delay);
}
}
e.Cancel = true;


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend