Progress on Loading Images.

Hi,

I have a form that needs to load many images.
I want to show the form first and then have a progress bar when loading those images.

Please help how to do it.

Thank you.
LVL 1
emi_sastraAsked:
Who is Participating?
 
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
Add a timer to your Project and then do this:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    ' Any code that you do in form load (except loading the pictures)
      
    Timer1.Interval = 1000
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
     Timer1.Enabled = False
    ' Load the pictures here
End Sub
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Hi again,

You can do this on form load:
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = TotalOfPictures

Then while you are adding the pictures

ProgressBar1.Minimum += 1
Application.DoEvents()
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
TotalOfPictures = number of the pictures to load. You must calculate this.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
emi_sastraAuthor Commented:
Hi jpaulino,

The problem is the form is not showing when loading images.
Could I show the form first?

Thank you.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Add a timer to your form with a interval of 1 second (1000 miliseconds) and enable it on the end of the form load. Then on timer1.tick you start to load the pictures. This will delay the picture to load and shows the form.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Don't forget when timer1.tick event start to disable i'm in the beginning using:

Timer1.Enabled = False
0
 
emi_sastraAuthor Commented:
Hi jpaulino,

Could you provide code as you mentioned?

Thank you.
0
 
emi_sastraAuthor Commented:
Hi jpaulino,

Thank you very much for your help.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Glad I could help and thanks for the grade.
0
All Courses

From novice to tech pro — start learning today.