繁华开满天机
那不叫gotfocus控件,叫gotfocus事件Dim tt As TextBoxPrivate Sub Command1_Click()MsgBox tt.TextEnd SubPrivate Sub Text1_GotFocus()Set tt = Text1End SubPrivate Sub Text2_GotFocus()Set tt = Text2End Sub对类似问题建议使用控件数组,将Text1设置为控件数组,不管有多少Text,只需一个GotFocus事件即可:Dim tt As TextBoxPrivate Sub Command1_Click()MsgBox tt.TextEnd SubPrivate Sub Text1_GotFocus(Index As Integer)Set tt = Text1(Index)End Sub