ARTICLE

ProgressBar Control with Button and MouseWheel Event in VB.NET

Posted by Shalini Juneja Articles | ASP.NET using VB.NET March 17, 2011
In this article we demonstrate on ProgressBar working by buttons and also by Mouse with MouseWheel Event.
Download Files:
 
Reader Level:

A visual basic ProgressBar control shows the progress of a task. it shows how much time a user has to wait to accomplish the task. ProgressBar are commonly used for downloading, file transfer. progress bar consist the rectangles of green color which shows the progress of the task.

ProgressBar control are of two types:

  • Determinate ProgressBar control
  • indeterminate  ProgressBar control  .

Determinate ProgressBar shows the sequential representation of a work and the scope of the work is known to you.

Indeterminate ProgressBar control is represent time based works and the scope of the works is not known to you.

The below Example Shows the ProgressBar with  button and MouseWheel Event

  • First we do the coding on form load:-

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)HandlesMyBase.Load
            ProgressBar1.Minimum = 0
            ProgressBar1.Maximum = 100
            ProgressBar1.Value = 0
        End
Sub

Then we take four button code for button is shown below

  • Button 1

         
    Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click
            If ProgressBar1.Value < 100Then
                ProgressBar1.Value += 5
            End If
        End
    Sub

  • Button 2

             Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
                If ProgressBar1.Value > 0 Then
                    ProgressBar1.Value -= 5
                End If
            End
Sub

  •  Button 3
          
        
    Private Sub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button3.Click
            ProgressBar1.Value = 100
        End Sub

  • Button 4

        
    Private Sub Button4_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button4.Click
            ProgressBar1.Value = 0
        End
    Sub

Now we write code for MouseWheel event

  •     Mousewheel Event

    Private Sub Form1_MouseWheel(ByVal sender As Object,ByVal e As System.Windows.Forms.MouseEventArgs)Handles        
   
Me.MouseWheel
    If e.Delta > -1 Then
            If ProgressBar1.Value < 100 Then
                ProgressBar1.Value += 5
            End If
        Else
            If ProgressBar1.Value > 0Then
                ProgressBar1.Value -= 5
            End If
        End If
    End
Sub


Output:





 


Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor