Hi all
Once again I'm looking for someone's invaluable help!
My web application exports a report to pdf which can take up to 12 seconds to complete and create a pdf file. Then I rename the file and redirect the web browser to show the file.
What I think I need to do is to check for the file every 1 second for 12 seconds using a do while loop. I'm new to coding loops and new to timers so please help! I've made a stab at it as follows:
THANKS IN ADVANCE!
Dave
Once again I'm looking for someone's invaluable help!
My web application exports a report to pdf which can take up to 12 seconds to complete and create a pdf file. Then I rename the file and redirect the web browser to show the file.
What I think I need to do is to check for the file every 1 second for 12 seconds using a do while loop. I'm new to coding loops and new to timers so please help! I've made a stab at it as follows:
VB.NET:
'Insert time delay to allow for print conversion to pdf
Dim timer As System.Timers.Timer = New System.Timers.Timer
timer.Interval = 12000
timer.Start()
'Rename the report file to the user
Do While timer.Enabled = True
Loop
If My.Computer.FileSystem.FileExists("C:\Test.pdf") = True Then
My.Computer.FileSystem.RenameFile("C:\Test.pdf", "Test_user.pdf")
Else
'Loop again
End If
Response.Redirect("C:\Test.pdf")
Dave
Last edited by a moderator: