Solved

How to pause loop after form loses focus vb.net

Posted on 2011-03-25
3
413 Views
Last Modified: 2012-05-11
Hi
I have a program written in vb.net it uses a loop to upload files to an ftp site. My problem is if the form loses focus although the upload is going on the user loses control of the form until the upload is finished. How can I make it so that this does not happen.

Thanks

Nick Steele
0
Comment
Question by:nsteele84
3 Comments
 
LVL 16

Accepted Solution

by:
ToddBeaulieu earned 500 total points
ID: 35215082
Hello,

You're most likely doing this upload on the main thread, in response to a UI control.

You need to use a worker thread to perform the upload in the background. That thread would have to monitor for requests from the user to cancel. You'd also have to control program exit if it's in progress.

There's quite a bit involved in threading, but there are tons of references online with basic examples.
0
 

Author Closing Comment

by:nsteele84
ID: 35215112
Hi I had an idea it was to do with threads. I have never used them but no it is time. Thanks
0
 
LVL 1

Expert Comment

by:jesusaflores
ID: 35215304

What control used for upload the files??, if use the standar control, so the ejecution have run in other thread the process to  upload, but if use AJAX is not necessary because the processes are asynchronous
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

825 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