Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 5 - Executing Long-Running Tasks with the Prog...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Executing Long-Running Tasks with the Progress Bar in ASP.NET
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 38
    2005-08-31

    Table of Contents:
  • Executing Long-Running Tasks with the Progress Bar in ASP.NET
  • The structure of the VS.NET solution
  • The long-running process (or task)
  • Showing the progress
  • What is “ProcessingStatus.vb” in detail?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Executing Long-Running Tasks with the Progress Bar in ASP.NET - What is “ProcessingStatus.vb” in detail?


    (Page 5 of 5 )

    You must have observed that I wrote plenty of statements starting with “ProcessingStatus” in the above fragments of code (of the previous sections).  Actually, it is my own class having only “shared” members. I developed this class to hold all GUIDs and their percentage values respectively. Of course, you could also develop a very good concrete class rather than a class with all “shared” members.  But, this class has already passed my requirements (apart from thread safety issues).  Let’s see the class:

    Imports System.Collections

    Public Class ProcessingStatus

      Private Shared Status As New Hashtable

      Public Shared Function getValue(ByVal itemId As Guid) As Object
       
    Return Status(itemId)
     
    End Function

      Public Shared Sub add(ByVal ItemId As Guid, ByVal oStatus As Object)
       
    'make sure that oStatus contains only the values 0 through 100 or -1
       
    Status(ItemId) = oStatus
     
    End Sub

      Public Shared Sub update(ByVal ItemId As Guid, ByVal oStatus As Object)
       
    'make sure that oStatus contains only the values 0 through 100 or -1
       
    Status(ItemId) = oStatus
     
    End Sub

      Public Shared Sub remove(ByVal ItemId As Guid)
       
    Status.Remove(ItemId)
     
    End Sub

      Public Shared Function Contains(ByVal ItemId As Guid) As Boolean
       
    Return Status.Contains(ItemId)
     
    End Function

    End Class

    In the above program, I maintained a single “HashTable” throughout the class to hold all GUIDs and their respective percentage values. All of the methods in the above class provide a better interface to the “HashTable,” so that you can do all CRUD operations with “HashTable” efficiently.

    Summary

    The sample downloadable solution is entirely developed using Visual Studio.NET 2003 Enterprise Artchitect on Windows Server 2003 Standard Edition.  But, I am confident that it would work with other versions of Windows (which support .NET 1.1) versions as well.

    You can further enhance the solution to show the status (or progress) in a small separate window as well to make it convenient to the user.  But this article focussed only on the core issue of handling tasks rather than UI. I hope this article will help you to solve your needs.

    Any comments, suggestions, bugs, errors, feedback etc. are highly appreciated at jag_chat@yahoo.com.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Thanx a lot for this. I've always thought that multithreading is only useful for...
       · Hello,The article is just only to give you an idea of implementing the progress...
       · You can still further discuss, if you have doubts. I am here to answer you.
       · Any thoughts on how this might be applied to file uploads? It seems like the...
       · You might use the concept of "streaming the binary content" for your requirement. I...
       · Hi, Thanks for sharing this code. My question is how is the 'requestId' got removed...
       · Good catch! Even I never thought of it. Right now, I could not think of very good...
       · I copied and run the code in my machine and getting "ProcessingStatus not defined"...
       · Have you had any further thoughts on "how is the 'requestId' got removed in case...
       · Hi thereI'm trying to use your example but the doprocess is not starting and...
       · Hi,I'm also using your technique to show progress, however i'm concerned about...
     

    VISUAL BASIC.NET ARTICLES

    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway