Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
VB.NET General Discussion
pause a thread, let other threads run
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Ron Miel, post: 132881, member: 33608"] Hi there. In my application I have a loop that makes calls to a website to download data. I'm using a DownloadDataAsynch call with a handler. I'm making many such calls in a loop. What I'd like to do is, if I have more than a certain number of replies pending, I should pause the loop and let the data handlers run. How do I do that? [code] Dim DataReader As SqlDataReader = sp_call.ExecuteReader Dim count As Integer = 0 [COLOR=DarkGreen] '--------------------------- ' loop through results ' get description for ' each item on the list '---------------------------[/COLOR] While DataReader.Read() [COLOR=DarkGreen]' get the item ID[/COLOR] Dim itemID As String = DataReader(0).ToString Dim request_string As String [COLOR=DarkGreen]'get the data for that item[/COLOR] request_string = [ web request constructed using item no ] [COLOR=DarkGreen]' create an asynchronous call[/COLOR] Dim data_downloader As New WebClient AddHandler data_downloader.DownloadDataCompleted, AddressOf Data_Downloader_complete data_downloader.DownloadDataAsync(New Uri(request_string), count) items_pending = items_pending + 1 If items_pending > 50 Then [ pause until items_pending < 50 ] End If End While [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
VB.NET General Discussion
pause a thread, let other threads run
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom