且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用vb.net在Windows应用程序中使用进度条

更新时间:2023-01-13 08:01:36

请,阅读本文: ProgressBars [ ^ ]。在那里你可以找到如何使用进度条的信息。
Please, read this article: ProgressBars[^]. There you'll find information how to use progressbars.


Public Class Form1



Dim iCounter As Integer



Private Sub Timer1_Tick(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Timer1.Tick



如果iCounter> ProgressBar1.Maximum然后

退出Sub

结束如果



ProgressBar1.Value = iCounter

iCounter = iCounter + 1

End Sub



Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System。 EventArgs)处理Button1.Click

Timer1.Enabled = True

End Sub



Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button2.Click

Timer1.Enabled = False

End Sub



Private Sub Button3_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button3.Click

iCounter = 0

ProgressBar1.Value = 0

结束子

结束班
Public Class Form1

Dim iCounter As Integer

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If iCounter > ProgressBar1.Maximum Then
Exit Sub
End If

ProgressBar1.Value = iCounter
iCounter = iCounter + 1
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
iCounter = 0
ProgressBar1.Value = 0
End Sub
End Class