设一个窗体变量,记录下最近一次获取焦点的textbox
Option Explicit
Private ntext As Integer
Private Sub Command1_Click()
If ntext = 1 Then
Text1.Text = Command1.Caption
ElseIf ntext = 2 Then
Text2.Text = Command1.Caption
End If
End Sub
Private Sub Command2_Click()
If ntext = 1 Then
Text1.Text = Command2.Caption
ElseIf ntext = 2 Then
Text2.Text = Command2.Caption
End If
End Sub
Private Sub Text1_GotFocus()
ntext = 1
End Sub
Private Sub Text2_GotFocus()
ntext = 2
End Sub