Non-locking Sleep/waitfor/delay Function For ASP.NET?

Apr 27, 2011

I am writing an ASP.NET class that interfaces with an external application. The flow of the transaction between the web server and this application is as follows:My object writes a file to a directory.The outside application detects this file and processes it. This can take between 1-5 seconds.The outside application writes a response file to the same directory.My object detects the response file and parses the results.The 1-5 seconds it can take for the external application to process my file is my problem. The most straightforward way to wait for the file seems to be something like this:

Do While Not File.Exists(f)
Thread.Sleep(500)
Loop

Of course, Thread.Sleep() completely locks up the rest of my website until the outside application processes the file. Clearly, this is not a workable solution.How can I effectively "wait" for my file to be processed without locking up the rest of my website?

View 1 Replies


ADVERTISEMENT

VS 2010 Pause / Delay Code (can't Use Sleep Function)

Aug 26, 2010

I have another problem with my bot.

[Code]...

After the 7th line I need a pause until a submit button pops up on the screen. The submit button is hidden until the getelementbyid.focus is run. I cant use webbrowser_documentcompleted because the submit only unhides itself, and I cant use Sleep() because that just stalls the whole block.

View 9 Replies

Delay Loops Without Using (Sleep Or Timer)

Dec 20, 2009

Is there is way to delay loops without using (Sleep or timer) in VB

Because on java you cant do something like this

For(i = 0; i< 100; i++) {
Event.Wait(3000)
Animate(i);
}

I dont want to use sleep because your control is dead while is at sleep And using timer waste memory and process timer plus more coding is needed!

View 5 Replies

Creating A Delay In A Loop Without Thread.Sleep()?

Apr 22, 2012

i have a web browser control, that refreshes pages on a loop after calling a few subs, i need to create a delay in the loop so that the page has a chance to refresh and redisplay before it loops again. i tried the code below, but it seemed to freeze the entire form, elements including, so the web browser didnt refresh before the loop, so how could i create a non form-freezing delay for a loop?

For count = 1 To 20
WebBrowser1.Navigate("URL")
simcheckcheck()

[code].....

View 4 Replies

VS 2008 Difference Of Sleep Function And Pause Function (using Timer) Between A Loop

Aug 20, 2009

Hi. what is the difference of sleep function and pause function (using timer) between a loop.

View 12 Replies

Use "System.Threading.Thread.Sleep(15)" As The Delay Code But Freeze The Form

Jul 19, 2011

I've been trying to use "System.Threading.Thread.Sleep(15)" as the delay code but if freeze the form. I used this "Location.Refresh()" where location is the name of the form, but it didn't give me what I need. This code is going to work on a ProgressBar while typing and the value of the progress bar change while typing. The progress bar jumps to the new value and I want it to move. So I thought about puting it in a "For ... Loop" but the whole form freezes.

[Code]...

View 1 Replies

VS 2008 "System.Threading.Thread.Sleep()" - Showing The Images With A Delay

Dec 31, 2009

I have 5 Picture Boxes, each picture box has an image but all 5 of them has a visibility of false. I have a button, when clicked will show 5 of the images. But showing the 5 images with a delay. So it's going to be

[Code]...

View 6 Replies

Pause In Code Can't Use Sleep Function?

Jan 4, 2011

"'I'm having an issue sorting out why my code isnt working. When I "step into" it line by line i can get it all to work exactly how I want, however when I actually run the macro i get an subscript error 9. The code basicly sets a .CSV url to a variable "CurrentURL". The code then launches this url which opens a .csv window called table.csv. I want to copy 2 columns off this window and paste it to another document called "MPT_CAPM_v1", then close table.csv. Here is my code the red line is where I believe I'm running into my error.'This macro opens a URL, copies and pastes the price data into the sheet

[Code]...

I think the error may be caused by the fact it takes about 4-5 seconds to open table.csv in excel, and my line of code is trying to select a window that isnt currently open. After I get the error message, table.csv opens up. I've tried Loops & Sleep functions to try to input a delay, but regardless it seems that table.csv will not open until the end of said loop or delay.

View 6 Replies

Sleep Function Visual Basic?

May 31, 2011

Is there a simple sleep function in Visual Basic that doens't involve thread.

Something similiar like there exists in: C: sleep(1);

We also tried this code:Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long)' pause for 5 seconds
Sleep 5000 but it didn't work. It gave me this error: PInvokeStackImbalance was detected

[Code]...

View 1 Replies

Sleep Function While Processing Window Events

Feb 18, 2010

I wrote the below function to sleep, while processing the window events. It works well enough, but I'd like to improve the accuracy of the sleep. Example - If you call it with 10 msec (0.010), it can take up to 15 msec of real time before it exits. How to make it closer to 10 msec?

Public Sub Spin(ByVal TimeInSec As Double)
Dim tsStart As TimeSpan = Date.Now.TimeOfDay
Dim tsNext As TimeSpan = tsStart
Dim TimeSlept As Double = tsNext.TotalSeconds - tsStart.TotalSeconds
'wait for Time seconds
[Code] .....

View 9 Replies

VS 2010 - Using System.Threading.Thread.Sleep(5000) To Let My App Pause/sleep For Some Time

May 25, 2010

Currently I'm using System.Threading.Thread.Sleep(5000) to let my app pause/sleep for some time. This works great but I can't open my app anymore when it's sleeping and it uses about 25% of my CPU. I guess there must be a better way to do this. I also tried using a timer but that didn't work out to well for me..

View 5 Replies

How To Use Timer Function Just As Time Delay

May 29, 2010

What line of code would I need to use the timer function just as a delay, so like as lines are being executed, once it gets to this timer it waits for say 1500 milliseconds before execution is continued.

View 4 Replies

VS 2008 : Delay Function Without Freezing Up The Program?

Aug 16, 2009

im looking for a way to have my program wait a certain amount of seconds before it goes on to the next command, ive tried the sleep command but that freezes up my program and i cannot let that happen, ive heard of using timers as a delay but i don't really know how to do that.

View 4 Replies

Time Delay - Make GUI Program To Delay Before The Next Command

Dec 21, 2009

I know that time delays have been covered before around almost everywhere. however a method that forgoes forcing the GUI to become temporarily non-responsive, is all but a myth, or at least to my findings. i have the need for a GUI program to delay before the next command, however using the current method, detailed following, it causes the desired effect however it dose make it much less polished as when you click anything else on the GUI it goes un-responsive for the directed time. [Code] make a sub called say Tdelay( milseconds as integer) and have it run a loop as many times as the milseconds variable indicates and each time making the thread delay for 1 milsecond and then update the GUI/form in some way, then re-loop.

View 7 Replies

Left Click - Sleep - Move Mouse - Sleep - Moves Mouse To First Location (but Doesn't Click)

Apr 28, 2012

This is the code I am working with...

[Code]...

View 6 Replies

Thread.sleep Precision - Sleep A Thread For A "tick"

Nov 27, 2009

is there anyway to sleep a thread for a "tick". i.e. the tick in StopWatch.ElapsedTick. right now the best i could achieve is this thread.sleep(1). i need it faster

View 13 Replies

ADO.NET And SQL Locking?

Sep 23, 2010

I am in the process of writing an application that requires a single transaction updating several tables. The front end has a header record and several detail records. I do not maintain any type of lock on the original read. The read is performed by calling a stored procedure in an existing database to pass back the data.

When I update the data each detail record is updated individually. Is there away I can update all of the records within a single transaction? The update will be performed via a stored procedure that is stored on the server. I cannot store the code in the application as other applications will need to use the same server side code. I can handle updating a single record my issue come about when I've updated 5 records and the 6th fails, how do I rollback the 1st 5 records.

View 2 Replies

.net - Locking A Control From Another Thread In VB

Mar 18, 2011

I am developing a parser application to build a call tree from DDL files that have been extracted from a database. The idea is to take a large number of these DDL files and determine exactly what calls what. To do this I am using a .NET TreeView. The final output I am working toward is something like this:

-Proc1
-Proc2
-Proc3

[Code].....

View 2 Replies

.net 2.0 Threading File Locking

Oct 3, 2010

I'm using vb.net 2005, I've got the following code running a thread to download a file. However, the process fails sometimes when trying to read the local copy of the file. I think I may need to unlock the local file somehow but I'm not sure how to do this.[code]

View 1 Replies

C# - Application Suddenly Locking Up

Jan 10, 2012

i have this application, that creates various custom AppDomains, each app domain executes a assembly and its dependencies, like a plugin, a separated assembly, that manipulates database, own resources, etc.

the application runs fine for a while, but suddenly, it locks up... the process does NOT die, it just freezes, i ran a remote debugger on top of it, on the thread window i can see EVERY thread, they are with the status "running" (not "thaw") but, in the same place, not executing. i can pause and run the debug, and it remains in the same place. there are NO locks, synlocks, monitors, on the code and the code for loading the appdomains is very simple, no big deal on it. like i said, its working, but after a while, it locks up. Any ideas on this environment?

View 1 Replies

Locking - Block .exe To Launch?

Feb 17, 2012

does someone have an example code for how to prevent .exe files to be started?

Something like this might work:

For Each OSKInstance As Process In Process.GetProcessesByName("OSK").ToArray
OSKInstance.Kill()
Next

But that might be resource intense as a while loop is running all the time. Is there a smarter way to lock an .exe?

View 1 Replies

Locking Any File In PC From Others Access

Jun 22, 2010

How could I lock any file in my PC from others access? I am trying to lock some my video, picture, Excel and Word file in my PC by using Visual Basic. I am using Visual Studio 2008 to develop this application but I am unable to do this job. It'll be something like security utility application. Actually without me, some other people also using my computer and I am trying to lock their access in my personal file. And I wish to know the tools which I can use for this job. I am just a Beginner on this development field.

View 4 Replies

Locking Out Keyboard In Textbox

Dec 8, 2009

I am in the process of writing a pos for the first time for a friend for his new restaurant. I am need to allow users to input floating numbers only. How do lock out the keyboard?

[Code]...

View 9 Replies

SQL Transaction Locking Whole Tables?

Mar 7, 2012

I am trying to use a transaction for the duration that the dialog is open and then commit the changes once the dialog has been ok�d or rollback'd if canceled by the user.My problem is when I use the transaction it is locking the whole of the tables that I�m using to update and insert new records too.I update the record in the first (current) table and insert a new record into the second (history) table. Obviously this is causing me problems as I only want the transaction to lock the specific records i'm updating and not allow a new insert record with my PK associated to my that I�m updating, not lock the whole of the 2 tables.This is my code[code]....

View 3 Replies

Threading And Object Locking

Mar 22, 2011

I have a problem in a multi-threaded application where I'm getting deadlocked waiting for an object to beocme available.

[Code]...

View 1 Replies

VS 2010 Locking A Control?

Mar 12, 2011

In Visual Basic 6, locking a control would prevent the user from selecting a control without greying it out like disabling it would. Is there a way of doing this in Visual Basic 2010?

View 9 Replies

Writing To XML Log - File Locking?

Oct 15, 2009

Simple question. I have a log of actions that is in XML. When some action occures, the XML log is updated. I am using:Dim xmlData as XElement = XElement.Load( "DataLog.xml" )

to load the existing data. I then create a new XElement (NewData) and use:xmlData.AddFirst( NewData )Which puts the latest item at the beginning of the log. And finally, I write it out using:xmlData.Save( "DataLog.xml" )Ok, that all works fine. But there is no testing to see if anyone has (or is) updating the file ("DataLog.xml") during the process. This may result in lost data. Is there an accepted way to implement some sort of file locking structure that can be used to prevent this potential loss?

View 8 Replies

Writing To XML With File Locking

Nov 2, 2009

I have some code based on some previous posts that just won't work right.The code all runs without error.

-' strErrorLog holds a valid file name with full path
-' xmlNewError holds a valid xElement value

Using holdFile As New IO.FileStream(strErrorLog, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite, IO.FileShare.None)[code]When I step through the code, everything works.There is no error on the xmlError.Save call.However, the actual file is NOT updated.If I remove the "Using" commands and change the save to "xmlError. Save(strErrorLog)", then it writes just fine..It's got to be something really simple, but it's frustrating that I don't get an error message.But it does unlock the file..

View 1 Replies

.net - Locking - Extent And Modes Of Failure

Jan 9, 2012

I've stress tested the code below and it seems to work fine - what are the dangers of not locking in the simple case where there is a single thread writing and a separate thread reading a simple variable? Have a class that has a public property...

[Code]...

View 3 Replies

.net - Selecting Only The Filled Controls And Locking Them?

Jan 13, 2012

This is the situation when there is a shift change and one record is started by one person and finished by another. What one has written another can't change but must finished a record. So u must lock only the combo boxes and text boxes that are filled. This code lockes all the combo boxes and text boxes and 2 check boxes (NEZAVRSENE_INTERVENCIJE and IZMENA_RASKRSNICE) by clicking on a NEZAVRSENE_INTERVENCIJE check box. Lets say I have combo boxes 1 2 and 3 and text boxes 1 2 and 3 and I have to lock only the ones that are filled. How do I code that another check box lockes just the filled controls?

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved