show progressbar

spen2

New member
Joined
Sep 28, 2005
Messages
3
Programming Experience
Beginner
Hey guys, how r u all doing today? I hope great!


this is another minor problem:

I would like to

Display the progressBar with timer control when the user saving and reading files (and slow the progressBar down to 2 sec. to display)

please send me the code and the location where to place it in code

I have a child form with a SAVE menu control.

Thank you very much in advance,

Spen2
 
It is not clear what you exactly want, what u want is to display progress bar filling up during the file save operation.
If it is so,, to my knowledge you don't have any clue of how many seconds OS takes to save the file.. so you have to just animate the progressbar and finally complete the progress bar once the save is done.

If you can further clarify exact requirement I can try on this
 
Maybe this code can help you

Regards

Public Class Form1
Inherits System.Windows.Forms.Form
#
Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents pb As System.Windows.Forms.ProgressBar
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents lblInfo As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.pb = New System.Windows.Forms.ProgressBar
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.lblInfo = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'pb
'
Me.pb.Location = New System.Drawing.Point(24, 56)
Me.pb.Name = "pb"
Me.pb.Size = New System.Drawing.Size(376, 24)
Me.pb.TabIndex = 0
'
'Timer1
'
Me.Timer1.Enabled = True
Me.Timer1.Interval = 1000
'
'lblInfo
'
Me.lblInfo.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.lblInfo.Location = New System.Drawing.Point(24, 8)
Me.lblInfo.Name = "lblInfo"
Me.lblInfo.Size = New System.Drawing.Size(376, 40)
Me.lblInfo.TabIndex = 1
Me.lblInfo.Text = "0"
Me.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(424, 94)
Me.Controls.Add(Me.lblInfo)
Me.Controls.Add(Me.pb)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.Name = "Form1"
Me.Text = "ProgressBar Control Sample"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
pb.Value += 1
lblInfo.Text = pb.Value.ToString
If pb.Value = 100 Then
lblInfo.Text = "That's it."
Timer1.Dispose()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub

End Class




spen2 said:
Hey guys, how r u all doing today? I hope great!









this is another minor problem:

I would like to

Display the progressBar with timer control when the user saving and reading files (and slow the progressBar down to 2 sec. to display)

please send me the code and the location where to place it in code

I have a child form with a SAVE menu control.

Thank you very much in advance,

Spen2
 
Using a ProgressBar for something that takes two seconds is pointless. Just change the cursor to WaitCursor. If the operation could potentially take a long time then that's a different matter. How exactly are you saving this file? The idea would be that if you have 100 lines to write to a file then you increment the ProgressBar's Value property after writing each line. Note that continually updating a ProgressBar can actually slow down your process.
 
jmcilhinney said:
Using a ProgressBar for something that takes two seconds is pointless. Just change the cursor to WaitCursor. If the operation could potentially take a long time then that's a different matter. How exactly are you saving this file? The idea would be that if you have 100 lines to write to a file then you increment the ProgressBar's Value property after writing each line. Note that continually updating a ProgressBar can actually slow down your process.


how do u do that jmcilhinney, by changing the mouse cursor to the waitCursor
Does it works with web form???
Appreciate your help dude:p
 
Back
Top