|
-
Jan 11th, 2008, 10:05 AM
#1
Thread Starter
New Member
Progress Bar Help
hi, can someone please help me, i have added a progress bar and i added a start and stop button, the start is working fine, but i dont know the coding for the stop button could someone please tell me the coding for the stop button please, here is my codng for the start button, any help would be appreciated, thanks
Code:
Public Class Form1
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
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
End Sub
-
Jan 11th, 2008, 10:14 AM
#2
Re: Progress Bar Help
Thread moved from Classic Visual Basic (VB6 and earlier) forum to VB.Net (VB2002 and later) forum.
-
Jan 11th, 2008, 11:08 AM
#3
Thread Starter
New Member
Re: Progress Bar Help
please, does anyone know the coding for the stop button?
-
Jan 11th, 2008, 11:32 AM
#4
Fanatic Member
Re: Progress Bar Help
I dont know if this will work, but you can create an event for the stop.
Once the stop button is clicked you raise that event.
-
Jan 11th, 2008, 12:35 PM
#5
Re: Progress Bar Help
Are you trying to Stop the for - next loop in button1? As usual I don't get the question.
-
Jan 11th, 2008, 01:15 PM
#6
Re: Progress Bar Help
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
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|