我用vb编程编写一个打字程序,但是总是提示代码错误:缺少函数或变量,怎么解决?
Subzimu()RandomizeDimiAsIntegerDoi=Int(Rnd*58+65)LoopWhilei>90Andi<97L.Caption=Chr(i)...
Sub zimu()RandomizeDim i As IntegerDo i = Int(Rnd * 58 + 65)Loop While i > 90 And i < 97L.Caption = Chr(i)L.Left = Rnd * (Me.ScaleWidth - L.Width)L.Top = 0End Sub Private Sub Command1_Click()zimuL.Visible = TrueTimer1.Interval = 200End Sub Private Sub Form_KeyPress(KeyAscii As Integer)If L.Caption = Chr(KeyAscii) Then zimuEnd IfEnd Sub Private Sub Timer1_Timer()L.Top = L.Top + 100If L.Top >= Me.ScaleHeight ThenL.Caption = zimuEnd IfEnd Sub说明:timer事件驱动的L.Caption = zimu这里总是提示错误,怎样解决?
展开
展开全部
Sub zimu()
Randomize
Dim i As Integer
Do
i = Int(Rnd * 58 + 65)
Loop While i > 90 And i < 97
zimuL.Caption = Chr(i)
zimuL.Left = Rnd * (Me.ScaleWidth - zimuL.Width)
zimuL.Top = 0
End Sub
Private Sub Command1_Click()
zimuL.Visible = True
Timer1.Interval = 200
Call zimu
Text1.SetFocus
End Sub
Private Sub Form_Load()
Text1.Text = ""
zimuL.Caption = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If zimuL.Caption = Chr(KeyAscii) Then
Call zimu
End If
Text1.Text = ""
End Sub
Private Sub Timer1_Timer()
zimuL.Top = zimuL.Top + 100
If zimuL.Top >= Me.ScaleHeight Then
Call zimu
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询