none
这段代码怎么写? RRS feed

  • 问题

  • 现有Form1上有Timer1.Button1.ProgressBar1,textbox1

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Timer1.Interval = 100
            ProgressBar1.Minimum = 0
            ProgressBar1.Maximum = 100
            ProgressBar1.Value += 5
            If ProgressBar1.Value = 100 Then
                ProgressBar1.Value = 0
            End If
    End Sub
    Private Sub ABC()

           for i =0 to 99

               textbox1.text=i & vbcrlf

          next
            ......
    End Sub

    过程ABC运行需要1分中,因时间较长,想变化进度条的值来缓一下紧张,写如下代码

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

    可是程序运行怎么看不到进度条的变化呢,还出现异常,要过程ABC运行的同时还要看到进度条的变化

    这代码怎么写?

    谢谢。



    2011年5月18日 12:37

答案