Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoEvents in VB.NET?

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
Hey guys,

Here's my boggle (Demolition Man...GREAT flick):

We have code that creates an xml document, saves it on the server, then does a shell call to a java app that grabs that saved xml file and generates a pdf.

Problem is that of timing: the xml file isn't getting saved fast enough, and as a result the java app is trying to grab it before its saved to teh directory.

What we'd like to do is force the file to be saved BEFORE the line of code that calls the shell command is fired (which would ensure that the file is available).

Any thoughts on how we could do this? We were hoping there would be some sort of DoEvents solution, but it doesn't look like this would be feasable.

Thanks,

D'Arcy
 
I'd hit the vb.net forum w/ this question, D'Arcy... sounds more like something a console app writer would know how to do more efficiently.

Off the top of my head, though, maybe you can just do a:

System.Threading.Thread.Sleep(5000)

call or something to just stall the app before it makes the shell call. I had to do this with a recent app I was developing where the client wanted AccessDB, and changes weren't being reflected in the db fast enough, and so my app wasn't reflecting changes till a refresh.

The sleep line was just what the doctor ordered in that case.
penny1.gif
penny1.gif
 
Thanks Paul!

I really do need to get my head around the whole threading aspect of .NET programming.

I'll give that a whirl and let you know how it goes.

Thanks,

D'Arcy
 
goal:
let ASP write out a file f1.xml for JAVA

solution tip:
build a file play the role as a control signal

procedure:
ASP delete a file flag.txt at server
ASP write f1.xml at server
ASP create a file flag.txt at server
ASP call shell to do JAVA

JAVA program
while not exists flag.txt {
sleep 10000
}
delete flag.txt
open f1.xml to do something
 
Frank, thats pretty much what we ended up doing (using the sleep command and checking to see if the xml document had been created yet).

However, we couldn't just use a flag.txt because multiple users would be accessing the application. That would mean that you'd need to have unique flag.txt files for each request, which is what we accomplished with the xml files (a GUID was produced and inserted in the xml files name, and thats how we did the sleep check).

Thanks for the post though
:)

D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top