I have a form which has a label and a progress bar. When the user clicks on a button to retrieve data from an external source, I want to display this form. When the main form returns a value I want to hide the form. In theory this should be very simple, but I am having issues getting the progress bar to update. I am trying to keep it simple but just increasing the value of the bar until it gets to 100 and then starting again - until the form is closed. Code is below:
If I leave out the code to update the value, the form displays but the progress bar doesn't move. If I include it, the form doesn't even display.
Any advice?
Sorry about all the questions but I'm new to this.
Mighty
Code:
Public Class ProgressBar
Private Sub ProgressBar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Set ProgressBar Range
Me.ProgressBar1.Minimum = 0
Me.ProgressBar1.Maximum = 100
Me.ProgressBar1.Value = 0
' Call function to update it
Call UpdateProgress()
End Sub
Private Sub UpdateProgress()
' Keep the progress bar rotating
While True
If Me.ProgressBar1.Value < 100 Then
Me.ProgressBar1.Value += 5
Else
Me.ProgressBar1.Value = 0
End If
End While
End Sub
End Class
If I leave out the code to update the value, the form displays but the progress bar doesn't move. If I include it, the form doesn't even display.
Any advice?
Sorry about all the questions but I'm new to this.
Mighty