File manipulation by a web service in vb.net --- no DoEvents, so what now?

If System.IO.File.Exists(str_save_file_with_jpg_name) And pgno = 1 Then

                System.IO.File.Delete(str_save_file_with_jpg_name)


                actfile.Save(str_save_file_with_jpg_name, System.Drawing.Imaging.ImageFormat.Tiff)

            End If

Open in new window


Haven't had a chance to test this yet, but I have a bad feeling about it.

I am pretty sure that if the file has to be deleted, the file save is going to fail because
the file I am supposed to be creating will already be in use to be deleted...I will probably run into a permissions problem because there is no delay between the deletion of the file and the
re-creation of the same file.

There is no DoEvents for a web service, so what is the proper way to handle this?

Thanks in advance!
codefingerAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
You might be able to use a Thread.Sleep(milliSeconds) to slow down the process...
0
 
codefingerAuthor Commented:
Did not actually encounter the problem after all, but this is a good solution if I do.
Thanks!
0
All Courses

From novice to tech pro — start learning today.