Solved

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

Posted on 2011-09-28
2
331 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 96

Accepted Solution

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

Author Closing Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most frequent problems a "newbie" developer may encounter is having to deal with different data formats. One for all: THE DATE We, as humans, need to "see" a date and then interpret it (much of the times this is an automatic operation)…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

630 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