473,473 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Setting up delay for function call

Hi,
I have function which creates two xml files,after creation these
xml's, I am calling another function which reads these xml files. Now
this function is causing exception becuase data has not been read from
xml file and stored in using by other control. I am looking out for
some workaround by which i can delay the calls for reading out these
xml files.

Thanks in advance
Manoj

Sep 11 '06 #1
2 2027
You might try executing the delayed action through a seperate thread.
Example:

Thread _ExceededThread;
ThreadStart _ExceededThreadStart;

private void startDelayedTaskProcess()
{
_ExceededThreadStart = new ThreadStart(DelayedTaskStarter);
_ExceededThread = new Thread(_ExceededThreadStart);
_ExceededThread.Start();
}

private static void DelayedTaskStarter()
{
Thread.Sleep(20000);
DoDelayedTasks();
}

There might be a better way... but this is the only way I know of right
now...
Aryan wrote:
Hi,
I have function which creates two xml files,after creation these
xml's, I am calling another function which reads these xml files. Now
this function is causing exception becuase data has not been read from
xml file and stored in using by other control. I am looking out for
some workaround by which i can delay the calls for reading out these
xml files.

Thanks in advance
Manoj
Sep 11 '06 #2
Manoj,

One way would be to create the files asynchronously using a new thread.
Doing so you can loop until the new thread which is creating the xml files
has completed and then read the files only after it has completed.

It would look something like this:

Dim NewThread As Threading.Thread = New Threading.Thread(AddressOf
CreateXMLFiles)

NewThread.SetApartmentState(Threading.ApartmentSta te.STA)

NewThread.Start()

While NewThread.IsAlive

'---Here you can continue other processing while you wait for the thread to
finish or just wait.

End While

'---It is now safe to read xml files.

And here is a multi-threading tutorial:
http://www.startvbdotnet.com/threading/default.aspx
Sincerely,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Aryan" <ma*********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi,
I have function which creates two xml files,after creation these
xml's, I am calling another function which reads these xml files. Now
this function is causing exception becuase data has not been read from
xml file and stored in using by other control. I am looking out for
some workaround by which i can delay the calls for reading out these
xml files.

Thanks in advance
Manoj

Sep 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shuo Xiang | last post by:
Greetings: I'm working on some graphical game and need to animate certain things (by continuously changing the x/y coordinate and update the display), however, the system is blinkingly fast so...
6
by: lucifer | last post by:
hi i need to insert delay in my program what function should i use the old delay is not supported by the VC6
20
by: Doug Thews | last post by:
I ran into an interesting re-pain delay after calling the Abort() method on a thread, but it only happens the very first time I call it. Every time afterward, there is no delay. I've got a...
7
by: mfeingold | last post by:
I am working on a system, which among other things includes a server and a ..net control sitting in an html page and connected to the server. I ran into a couple of problems, you guys might have...
21
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I make a 10 second delay? ----------------------------------------------------------------------- There...
6
by: sheldonlg | last post by:
I came across a problem and googling for an answer didn't help. What I want to do is run an AJAX script that sets a hidden variable on the form. I call the AJAX script from a javascript...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.