Utilizamos cookies propias y de terceros para mejorar la experiencia de navegación, y ofrecer contenidos y publicidad de interés. Al continuar con la navegación entendemos que se acepta nuestra política de cookies.
Prueba esto que está sacado del help de Visual Basic. Correlo paso a paso y veras lo sencillo que es usarlo. Ten en cuenta de agregar los controles que figuran en el código
Private Sub Form_Load() prgBar1.Visible = False tmrTimer.Interval = 1000 prgBar1.Max = 10 ' Timer will go for 10 seconds. End Sub
Private Sub cmdBegin_Click() prgBar1.Visible = True tmrTimer.Enabled = True End Sub
Private Sub tmrTimer_Timer() Static intTime ' Declare the static variable. ' The first time, the variable will be empty. ' Set it to 1 if it is an empty variable. If IsEmpty(intTime) Then intTime = 1
prgBar1.Value = intTime ' Update the ProgressBar.
If intTime = prgBar1.Max Then Timer1.Enabled = False prgBar1.Visible = False intTime = 1 prgBar1.Value = prgBar1.Min Else intTime = intTime + 1 End If End Sub