vb 堆栈空间溢出 怎么解决啊

来源:百度知道 编辑:UC知道 时间:2024/06/08 18:05:12
Private Sub Text4_Change()
'显示接收到的码元并判断是否产生错码 '
Dim i As Integer
If Val(text3Str(index)) = 1 Then text3Str(index) = "0"
If Val(text3Str(index)) = 0 Then text3Str(index) = "1"
For i = 0 To 30
Text4.Text = Text4.Text & text3Str(i)
Next i
End Sub

If Val(text3Str(index)) = 1 Then text3Str(index) = "0"
If Val(text3Str(index)) = 0 Then text3Str(index) = "1"

要是text3Str(index) 只有0和1的值,改成:
text3Str(index)=iif(Val(text3Str(index))=1,"0","1")
或者
If Val(text3Str(index)) = 1 Then text3Str(index) = "0" Else text3Str(index) = "1"

还有,在Text的Change里写Text=Text & ……,是死循环