什么叫红顶中介:为什么变量打印不见值只是空开位置?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 22:53:17
Private Sub Form_Load()

Dim KeyAscii As Integer
For i = 1 To 20
Call Text1_KeyPress(KeyAscii)

Next
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
a(i, 1) = Text1.Text
Picture2.Print i, a(i, 1)
Text1.Text = ""
End If
End Sub
以上程序运行时,只能打印数组的值,但其前面的I的值看不见,但位置却空着!为什么?
请教高人!
我将I定义成全局变量,可以打印了。但,全面是0!为什么?

Dim I As Integer
For I = 1 To 20
Call Text1_KeyPress(I) '//定义I就可以了,将I的值传给子程序Text1_KeyPress
Next
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
a(KeyAscii, 1) = Text1.Text'//keyascii为接受传过来的KEYASCII
Picture2.Print i, a(i, 1)
Text1.Text = ""
End If
End Sub

值没有传过去
Private Sub Form_Load()

Dim KeyAscii As Integer
For i = 1 To 20
Call Text1_KeyPress(i,KeyAscii)

Next
End Sub

Private Sub Text1_KeyPress(i,KeyAscii As Integer)

If KeyAscii = 13 Then
a(i, 1) = Text1.Text
Picture2.Print i, a(i, 1)
Text1.Text = ""
End If
End Sub