Solved

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

Posted on 2011-09-28
2
310 Views
Last Modified: 2012-05-12
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
Comment
Question by:codefinger
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
Comment Utility
You might be able to use a Thread.Sleep(milliSeconds) to slow down the process...
0
 

Author Closing Comment

by:codefinger
Comment Utility
Did not actually encounter the problem after all, but this is a good solution if I do.
Thanks!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction This article discusses the Chain of Responsibility pattern, explaining What it is;Why it is; andHow it is At the end of this article, I hope you will be able to describe the use and benefits of Chain of Responsibility.  Backgrou…
Introduction This question got me thinking... (http://www.experts-exchange.com/questions/28707487/GLOBALS.html) Why shouldn't we use Globals? This is a simple question without a simple answer.  How do you explain these concepts to a programmer w…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now