一段VB代码,实时显示计算过程。

代码
Option Explicit

Dim IsExit As Boolean


Private Sub Form_Load()
    
Dim L As Long
    Show              '关键
    
For L = 1 To 9999
        
If IsExit = True Then
            
Exit For
        
End If
        txtText1.Text 
= CStr(L)  'DoEvents在下一句
        DoEvents          '关键,与上一句的顺序也是关键
    
Next L
End Sub


Private Sub Form_Unload(Cancel As Integer)
    IsExit 
= True        '关键
End Sub

 

 

相关文章: