| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1997 人关注过本帖, 1 人收藏
标题:为何光标不移动
只看楼主 加入收藏
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
结帖率:100%
收藏(1)
 问题点数:0 回复次数:10 
为何光标不移动
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Then '实现光标转移
     Text2.SetFocus
   End If


Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Command1.SetFocus
  End If
End Sub
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Command3.SetFocus
 End If
End Sub
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 光标 
2008-12-06 15:15
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
收藏
得分:0 
可能没说清楚 是从确定到等录的Setfocus没有动作,前两个都行。麻烦高手赐教。
                                                  谢谢!
2008-12-06 15:25
逐日
Rank: 2
等 级:新手上路
威 望:5
帖 子:117
专家分:2
注 册:2008-9-22
收藏
得分:0 
都确定了还要登录何用?
或者为什么要确定呢?
2008-12-06 15:41
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
收藏
得分:0 
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Command3.SetFocus
 End If
End Sub
Private Sub Command3_Click()
    Frmdl.Hide '切换窗体
    Frmmain.Show
End Sub
为了切换窗体

边学边做,天天向上.
2008-12-06 18:34
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
收藏
得分:0 
以下是引用allanwu244在2008-12-6 18:34的发言:

Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Command3.SetFocus
 End If
End Sub
Private Sub Command3_Click()
    Frmdl.Hide '切换窗体
    Frmmain. ...


Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Call Command3_Click'这样不就OK了么?
 End If
End Sub

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2008-12-06 18:55
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
收藏
得分:0 
回复 第4楼 allanwu244 的帖子
好的 我试试

边学边做,天天向上.
2008-12-06 23:11
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
收藏
得分:0 
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Then '实现光标转移
     Text2.SetFocus
   End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Command1.SetFocus
  End If
End Sub
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Command3.SetFocus
   
 End If
  Call Command3_Click
End Sub
Private Sub Command3_Click()
    Frmdl.Hide '切换窗体
    Frmmain.Show
End Sub
还是不行

边学边做,天天向上.
2008-12-08 22:13
逐日
Rank: 2
等 级:新手上路
威 望:5
帖 子:117
专家分:2
注 册:2008-9-22
收藏
得分:0 
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Then '实现光标转移
     Text2.SetFocus
   End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Command1.SetFocus
  End If
End Sub
Private Sub Command1_Click()
  Call Command3_Click
End Sub
Private Sub Command3_Click()
    Frmdl.Hide '切换窗体
    Frmmain.Show
End Sub
Command1上按回车试试
2008-12-09 08:11
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
收藏
得分:0 
Public gdlyhstr As String '公共登录用户名变量
Private Sub Frmdl_Load()
  Command3.Enabled = False '登录按钮不可用
   Text1.Text = "" '输入框为空
   Text2.Text = ""
End Sub

Private Sub Command1_Click()
Dim gyhmstr As String '公共用户名
Dim gmastr As String '密码
         gyhmstr = "1"  '用户名变量
         gmastr = "1" '密码变量
         gdlyhstr = Text1.Text '公共登录用户名输入框
  If Text1.Text = gyhmstr And Text2.Text = gmastr Then
     Frmdl.Label1 = "欢迎" & Frmdl.gdlyhstr & "使用查询系统"
        Label1.ForeColor = vbBlue
      Frmdl.Caption = "欢迎登录"
    Command3.Enabled = True
  Else
  MsgBox "请输入正确的用户名和密码", vbQuestion, "信息提示"
      Text1.SetFocus
    Text1.Text = ""
    Text2.Text = ""
  End If
 End Sub
 
Private Sub Command2_Click()
If MsgBox("您确定退出查询系统吗?", vbYesNo + vbInformation, "退出系统") = vbYes Then
    Unload Frmdl
Exit Sub

ElseIf MsgBox("请重新输入用户名和密码", vbInformation, "重新登录") Then
   Text1.SetFocus
   Text1.Text = ""
   Text2.Text = ""
End If
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Then '实现光标转移
     Text2.SetFocus
   End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Command1.SetFocus
  End If
End Sub
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Command3.SetFocus
 End If
End Sub
Private Sub Command3_Click()
    Frmdl.Hide '切换窗体
    Frmmain.Show
End Sub
这是所有的原来代码 请再给我看看 是否有问题

边学边做,天天向上.
2008-12-09 10:24
逐日
Rank: 2
等 级:新手上路
威 望:5
帖 子:117
专家分:2
注 册:2008-9-22
收藏
得分:0 
Public gdlyhstr As String '公共登录用户名变量
Private Sub Frmdl_Load()
   Text1.Text = "" '输入框为空
   Text2.Text = ""
End Sub

Private Sub Command1_Click()
Dim gyhmstr As String '公共用户名
Dim gmastr As String '密码
         gyhmstr = "1"  '用户名变量
         gmastr = "1" '密码变量
         gdlyhstr = Text1.Text '公共登录用户名输入框
  If Text1.Text = gyhmstr And Text2.Text = gmastr Then
     Frmdl.Label1 = "欢迎" & Frmdl.gdlyhstr & "使用查询系统"
        Label1.ForeColor = vbBlue
      Frmdl.Caption = "欢迎登录"
    Command3.Enabled = True
  Else
  MsgBox "请输入正确的用户名和密码", vbQuestion, "信息提示"
      Text1.SetFocus
    Text1.Text = ""
    Text2.Text = ""
  End If
  Command3.Enabled = True
  Command3.SetFocus
End Sub

Private Sub Command2_Click()
If MsgBox("您确定退出查询系统吗?", vbYesNo + vbInformation, "退出系统") = vbYes Then
    Unload Frmdl
Exit Sub

ElseIf MsgBox("请重新输入用户名和密码", vbInformation, "重新登录") Then
   Text1.SetFocus
   Text1.Text = ""
   Text2.Text = ""
End If
End Sub

Private Sub Form_Activate()
Command3.Enabled = False
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = 13 Then '实现光标转移
     Text2.SetFocus
   End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
    Command1.SetFocus
  End If
End Sub
Private Sub Command3_Click()
    Frmdl.Hide '切换窗体
    Frmmain.Show
End Sub
2008-12-09 11:14
快速回复:为何光标不移动
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018319 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved