-
October 18th, 2007, 02:47 AM
#1
help required to use progress bar
hello
I m using progress bar in my vb.net application on loading records in datagrid
but problem arises that progress bar moves after loading the data grid
i want this to load with load time or before loading the grid
as progress bar completes it will show the records
plz reply soon
thanks in advance
-
October 18th, 2007, 04:16 AM
#2
Re: help required to use progress bar
How do you increment the progress bar? on what event?
Can you post the code?
-
October 18th, 2007, 10:54 AM
#3
Re: help required to use progress bar
-
October 18th, 2007, 11:46 PM
#4
Re: help required to use progress bar
i used the code as
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (Me.mkc_ProgressBar1.Value >= 0) Then
Me.mkc_ProgressBar1.Value += 1
Else
Me.Timer1.Enabled = False
End If
End Sub
Private Sub btn_Show_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Show.Click
Me.mkc_ProgressBar1.Value = 0
Me.Timer1.Interval = 1
Me.Timer1.Enabled = True
ShowSample()
End Sub
<Description("The value used to generate progress based on the maximum value."), Category("Custom")> _
Public Property Value() As Integer
Get
Return val
End Get
Set(ByVal Value As Integer)
Dim oldValue As Integer = val
' Make sure that the value does not stray outside the valid range.
If (Value < min) Then
val = min
ElseIf (Value > max) Then
val = max
Else
val = Value
End If
' Invalidate only the changed area.
Dim percent As Decimal
Dim newValueRect As Rectangle = Me.ClientRectangle
Dim oldValueRect As Rectangle = Me.ClientRectangle
' Use a new value to calculate the rectangle for progress.
percent = (val - min) / (max - min)
newValueRect.Width = newValueRect.Width * percent
' Use an old value to calculate the rectangle for progress.
percent = (oldValue - min) / (max - min)
oldValueRect.Width = oldValueRect.Width * percent
Dim updateRect As Rectangle = New Rectangle
' Find only the part of the screen that must be updated.
If (newValueRect.Width > oldValueRect.Width) Then
updateRect.X = oldValueRect.Size.Width
updateRect.Width = newValueRect.Width - oldValueRect.Width
Else
updateRect.X = newValueRect.Size.Width
updateRect.Width = oldValueRect.Width - newValueRect.Width
End If
updateRect.Height = Me.Height
' Invalidate only the intersection region.
Me.Invalidate(updateRect)
End Set
End Property 'Value() As Integer
Last edited by HanneSThEGreaT; October 19th, 2007 at 01:05 AM.
-
October 19th, 2007, 01:08 AM
#5
Re: help required to use progress bar
saimasattar, please read this before posting again. Using proper [CODE] and [/CODE] tags, makes code much easier to read!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|