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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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 / 53
    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


    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...
       · Hello Jags,I also have a similar implementation of the threading in my...
       · Very thanks for your article. I solved a long time task issue running asp.net over...
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek