?
Solved

How to pause loop after form loses focus vb.net

Posted on 2011-03-25
3
Medium Priority
?
418 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 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