?
Solved

How to pause loop after form loses focus vb.net

Posted on 2011-03-25
3
Medium Priority
?
423 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 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

850 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