vb Code:
Public Class Form1
private cancelled as boolean = false
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num As Integer
For num = 1 To 100
if cancelled then
exit sub
end if
ProgressBar1.Value = num
lblCounter.Text = Format(num / 100, "p")
lblCounter.Refresh()
Threading.Thread.Sleep(100)
lblvfound.Visible = True
lblvfound2.Visible = False
If lblCounter.Text = "100.00 %" Then
lblvfound2.Visible = True
ElseIf lblCounter.Text = "0.10 %" Then
lblvfound.Visible = True
End If
Next
MsgBox("The Virus Scanning Is Complete", MsgBoxStyle.OkOnly)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
cancelled = true
End Sub
end class