Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'd like to thank everybody for helping.
I'm using C#
I'm using code in a sequence and it's must go in order.
this code in a time with intercal(1000)
in code I'm loading crystal report as bellow:

private void timer1_Tick(object sender, EventArgs e)
{
       ReportDocument rpt = new ReportDocument();
       string path = Application.StartupPath + @"\Report.rpt";
       rpt.Load(path);

... etc
}

the next code can't be excuted because time again restart and so .. infinty.

on the line
rpt.Load(path);

the code can't be continue and the timer repeat again.

Thank you for your help

What I have tried:

I tried to make interval too long and after finishing reset it to 1000
Posted
Updated 1-Jun-21 1:10am

Not sure if I understand the question correctly but if you want to prevent the tick from reoccurring, you can use Timer.Stop Method (System.Windows.Forms) | Microsoft Docs[^] to halt the timer before you do anything else. Something like
private void timer1_Tick(object sender, EventArgs e)
{
       timer1.Stop();
       ReportDocument rpt = new ReportDocument();
       string path = Application.StartupPath + @"\Report.rpt";
       rpt.Load(path);
... etc
}
 
Share this answer
 
Thank you
Wendelius

I did that, it's working.
 
Share this answer
 
Comments
Richard Deeming 1-Jun-21 10:30am    
If you want to respond to a solution, click the "Have a Question or Comment?" button under that solution and post a comment.

Do not post your comment as another "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900