Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

FREE 12 month online training for ASP.NET & MS Expression Studio and a Free copy of MS Expression Web with Windows Server Purchase
Working with Progress Bar Control in VB.Net

Author: DevASP
Download Source Code : 336_ProgressBar.zip

In this article you will learn how to work with Progress Bar Control and Mouse Wheel event of the window form.

Create a New Project in VB.net. Drag a Progress bar control from tool box and place on form and now drag and drop four buttons on form having text  l< << >> >l. this is simple interface for this purpose.

Now write code on form load even of the form

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        ProgressBar1.Minimum = 0

        ProgressBar1.Maximum = 100

        ProgressBar1.Value = 0

 

End Sub

  • Now write code on button click events.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        If ProgressBar1.Value < 100 Then

            ProgressBar1.Value += 5

        End If

 

End Sub

 

 

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

 

 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

 

        ProgressBar1.Value = 100

 

End Sub

 

 

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

 

        ProgressBar1.Value = 0

 

End Sub

 

This is code for buttons now we will see how we can work with progress bar with mouse wheel scrolling. Select MouseWheel event from form1 events.Now write simple code in this event:

 

Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel

 

        If e.Delta > -1 Then

            If ProgressBar1.Value < 100 Then

                ProgressBar1.Value += 5

 

            End If

        Else

            If ProgressBar1.Value > 0 Then

                ProgressBar1.Value -= 5

 

            End If

        End If

 

End Sub

Now in if condition you see that e.delta > -1 this is important for us when we scroll mouse one time control comes in this event and if we scroll wheel up side e.delta value will < 0 and if we scroll down side e.delta value > 0. Only remember these things in mind. Now see this condition ProgressBar1.Value < 100 we are handling the exception and also in ProgressBar1.Value > 0 because progressbar value should be in range of progressbar1.minimum and progressbar1.maximum.

Article Comments
this is working.........

tanks for this coding...
i want more program plz upload program in my mail.......

that program is how to retrive the any oracle blob image format through vb.net

this program is urget.....

plz send this program...............

Have a nice day................


your's faithfully,
Hemanth kumar

Posted on 12/20/2006 9:31:39 AM by Hemanthkumar

well for your coding i have a small doubts vb.net & asp.net help me when i called you.

Thanks
Khan Mohamed

Posted on 5/15/2007 8:27:48 AM by khan mohamed

stupidity.
i am not going to run progress bar but other procedure also.
i want a program that show progressbar running when my procedure executing..

Posted on 6/15/2007 5:15:13 AM by vir

This Code is working.
Thanks for this .
Plz sent me more program related to datagrid ,how to add control to datagrid ..
plz send this pro..

Posted on 10/3/2007 3:21:22 AM by Abhay kuamr Patel

pls tell me code for transfering data present in datagrid view to excel sheet on click of the button, pl stell me

Posted on 12/19/2007 3:55:07 AM by hemadribabu

The code u given for processbar is not working, and not even not trowing any error, pls suggest me , i am using vb.net as frontend ,

Posted on 12/19/2007 3:56:56 AM by hemadribabu

Wow. Look at all the great comments !

Posted on 4/22/2008 11:22:31 AM by ROFLCOPTER

That is a realy helping artilcle!

Posted on 4/22/2008 12:03:20 PM by zeeshan

What is the use of progress bar

Posted on 5/27/2008 12:19:05 AM by sravani

Good Work,

although, i didn't use this code but it still really helped me out to understand the basics.

Posted on 9/14/2008 11:11:22 PM by eBloggy

hi,

Here i am creating a program to read a big text file in VB .NET and want to show the whole progress in a waiting panel having progress bar. Program is working fine but there is a problem that the lable I used to show the processing doesn't change the values during process. What should i do?
Pls Tell me.

Posted on 11/27/2008 4:40:51 AM by amit

Good Code......

Posted on 8/1/2009 12:27:48 AM by Naveed

hi , this is fine progress

Posted on 11/9/2009 12:30:05 PM by taghaddosi

thanks...............


do i have some more examples!!!

Posted on 12/17/2009 11:57:30 PM by dilip

Hi Dilip,

This article also related with progress bar...

http://www.devasp.net/net/articles/display/657.html

Thakns

Posted on 12/18/2009 6:48:55 AM by zunnair

Thanx Buddy...
This is Working....

Posted on 12/25/2009 3:46:34 AM by ArunkumaR

how to use in VB.net2003 Datagrid contorls

Posted on 1/3/2010 10:32:07 PM by jegan

This page provide Web Based progress bar .
http://www.devasp.net/net/articles/display/657.html


thanks

Posted on 1/20/2010 3:38:51 AM by rahul srivastava

i am doing graduation project.so i need ur help

Posted on 2/2/2010 6:55:40 AM by yishagerew

how to use progress bar on splash screen.what is code for that.
the time required for splash screen it is in form of progress bar

Posted on 2/16/2010 7:51:38 AM by kanchan

this code is useable

Posted on 2/16/2010 7:52:51 AM by kioki

pls send all vb.net componant program

Posted on 3/30/2010 7:50:46 AM by RAJIVGANDHI.V

Its working fine man..kip it up!

Posted on 5/11/2010 4:16:44 AM by Boniface Mutinda

this is useful for very beginners..but its not efficient information......

Posted on 5/15/2010 10:18:34 AM by sumalatha

thanx for u that is good idea ,the pr. working well
we need more ideas.
yours from Egypt.

Posted on 5/16/2010 3:59:18 PM by kallaf

It is Very easy. Thanks! Can we know about the various types of progress bar and related projects?

Posted on 5/23/2010 12:31:44 AM by Shivnath Karmakar

Thanks alot

Posted on 6/9/2010 1:31:10 AM by Javier

Thanks

Posted on 6/12/2010 2:49:14 PM by Shankar

Code is working properly.
But i need a help...
i m designing a crystal report.now i want that when i select a report from combobox and click to show button. then progress bar should be work..till it upload on crystalreportviewer1. Plz help for this and mail the solution on my emailid: rickyshiv@gmail.com.

Posted on 6/15/2010 4:01:34 AM by Rakesh Fhaujdar

nice code..
very helpful>>
tnx ;)

Posted on 6/30/2010 11:00:34 PM by emi

I am new to .Net but i have learned the above concept quickly.
I want to learn further. Could u guide me?

Posted on 8/3/2010 10:00:28 AM by Kishore

i want the progressbar run tel 20 and thae back to zero
how i can do it

Posted on 10/31/2010 2:07:50 PM by ali

Thanks This code is very nice

Posted on 11/17/2010 10:15:38 AM by balamurugan

Thanks nice code

Posted on 11/17/2010 10:17:20 AM by balamurugan

good code
Nice..
Thank you

Posted on 11/29/2010 8:17:31 AM by Bookworm

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Creating a Stop Watch in VB.Net

Disclaimer - Privacy
© 2002-2014 DevASP.net