I have a form with only 1 object on it , a progress bar.
when the form loads it runs the progress bar, which is working fine.
when the progress bar hits the max vaule i want the form to close but
no matter where i put the me.close the form always stays open.
can anyone help?
`
Public Class FrmPleaseWait
Private Sub FrmPleaseWait_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim x As Integer
Dim y As Integer
x = Screen.PrimaryScreen.WorkingArea.Width - 525
y = Screen.PrimaryScreen.WorkingArea.Height - 190
Me.Location = New Point(x, y)
CheckForIllegalCrossThreadCalls = False
With ProgressBar1
.Style = ProgressBarStyle.Blocks
.Step = 1
.Minimum = _MinProgressbarValue
.Maximum = _MaxProgressbarValue
.Value = _ProgressbarValue
End With
With ProgressBar1
.Style = ProgressBarStyle.Blocks
.Step = 1
.Minimum = _MinProgressbarValue
.Maximum = _MaxProgressbarValue
.Value = _ProgressbarValue
End With
'if you repress the button now, it won't restart now
Do
'ALL events in your form will ahve to wait until this loop is completed!
Threading.Thread.Sleep(100)
ProgressBar1.PerformStep() 'can't use this if ProgressBar1.Style = ProgressBarStyle.Marquee
Loop Until ProgressBar1.Value >= ProgressBar1.Maximum
Me.Close()
End Sub
End Class`