Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

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!
0
codefinger
Asked:
codefinger
1 Solution
 
Bob LearnedCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now