• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

How to pause loop after form loses focus vb.net

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.


Nick Steele
1 Solution

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.
nsteele84Author Commented:
Hi I had an idea it was to do with threads. I have never used them but no it is time. Thanks

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now