变量未定义:

螺丝刀2000 2002-05-15 09:08:04
Private Sub Text47_Change()
If KeyCode = vbKeyReturn Then
Text48.SetFocus
End If
End Sub

工程运行到KEYCODE时提示:
编义错误
变量未定义
在线等待!急!

...全文
138 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
gaoqi5037 2002-05-15
  • 打赏
  • 举报
回复
气死!
footballboy 2002-05-15
  • 打赏
  • 举报
回复
你可能是设计时双击Text47打开吧,一般打开的是Text47_Change事件处理过程,根据你想实现的功能看,应该用Text47_KeyPress才对,注意到没有Text47_Change过程是没有参数的,Text47_KeyDown带有参数KeyAscii

Private Sub Text47_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Text48.SetFocus
End If
End Sub
jyu1221 2002-05-15
  • 打赏
  • 举报
回复
Private Sub Text47_Change()
If KeyCode = vbKeyReturn Then
Text48.SetFocus
End If
End Sub
-----------------------------------------------
在Change中是不能访问KeyCode的,
只能在
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

End Sub
这里访问KeyCode这个变量
dyx 2002-05-15
  • 打赏
  • 举报
回复
Private Sub Text47_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Text48.SetFocus
End If
End Sub
螺丝刀2000 2002-05-15
  • 打赏
  • 举报
回复
If KeyAscii = 13 Then
Text48.SetFocus
End If

运行到KEYASCII时

还是提示变量未定义!

请大家帮帮忙!
dyx 2002-05-15
  • 打赏
  • 举报
回复
同上
螺丝刀2000 2002-05-15
  • 打赏
  • 举报
回复
我写的代码也没有错啊!
liuzhanwen 2002-05-15
  • 打赏
  • 举报
回复
If KeyAscii = 13 Then
Text48.SetFocus
End If
tony_jian 2002-05-15
  • 打赏
  • 举报
回复
If KeyAscii = 13 Then
Text48.SetFocus
End If

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧