DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2008
    Posts
    164

    how creat a cancel form / multi task

    hi,
    i have
    a function to export data with some loops now the problem is that
    when he is exporting the data the program stop responding and only
    respond when the job is done, and i need a option to cancel the job
    when it is running but the problem simple block all forms that is opened
    how can i creat some multi task for fix that problem?
    thanks a lot for your help

  2. #2
    Join Date
    Jul 2007
    Posts
    137
    place

    Code:
                Application.DoEvents()

    Inside your loop, then provide a cancel button the code will allow the button to fire.

    Regards,

    Sreve

  3. #3
    Join Date
    Feb 2004
    Location
    Longueuil, Québec
    Posts
    577
    The Application.DoEvents trick given by somebody else works well, but if there are a lot of iterations and/or a lot of events somewhere else, it sometimes slows down things too much.

    An alternative is to use a BackgroundWorker control in the form. This control is an easy way to start a new thread from a Windows Form and has a few properties and methods that can prove to be useful in some circumstances.

    You put the code to be executed in its DoWork event.

    To start the job, you call its RunWorkerAsync method.

    If you need to cancel before it has finished, you call its CancelAsync method.
    Jacques Bourgeois
    JBFI
    http://www3.sympatico.ca/jbfi/homeus.htm

Similar Threads

  1. Replies: 0
    Last Post: 01-17-2007, 10:38 PM
  2. Replies: 4
    Last Post: 07-10-2006, 07:07 AM
  3. Replies: 0
    Last Post: 02-23-2006, 07:08 PM
  4. Submit, Clear, and Cancel buttons on an ASP.NET form
    By Aldo Sarmiento in forum ASP.NET
    Replies: 0
    Last Post: 03-01-2002, 01:26 AM
  5. Replies: 2
    Last Post: 09-04-2001, 02:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links