VB操作焦点问题

来源:百度知道 编辑:UC知道 时间:2024/05/27 18:45:04
我想这么做 就是 3个按钮 分别为上下 和确定其中
command1_click 为
text1.setfous
commadn2_click
text2.setfous
确定按牛 我想这么做
就是说
if text1.setfocus then
msgbox "text1"
elseif text2.setfous then
msgbox "text2"
end if
可是程序说我缺少函数变量 不行 我也知道的声明 也用过 me.activecontrl = text1 or text2 但是也不行
我就是想知道VB中怎么判断焦点的位置 强人给留方法吧 谢谢
3L的意思是做不了吧

Dim a As Integer
Private Sub Command1_Click()
Text1.SetFocus
End Sub

Private Sub Command2_Click()
Text2.SetFocus
End Sub

Private Sub Command3_Click()
If a = 1 Then
MsgBox "Text1"
ElseIf a = 2 Then
MsgBox "Text2"
End If
End Sub

Private Sub Text1_GotFocus()
a = 1
End Sub

Private Sub Text2_GotFocus()
a = 2
End Sub

text1.setfocus 无法构成驱动事件

写在text1 chang事件里面!

onclick... 不过不能给text box 用, 你只能看textbox的text 有没有变。 没办法的。

你的粗心罗

command2_click 打错了