-
1 . how can I find a visualbasic control programatically at runtime
I mean :
I will click a command button at runtime and
I will show item's name that focused before command button without describing any special property of that item.
I doesn't want to write
msgbox item.name (item.name is static.)
instead I want to write code that firstly find which item focused before command button and then show its name.
(item.name is dinamic.)
-
hmm
Let me make sure I understand first
You want to click on a command button... and you want to know what item had focus before you clicked that button
correct?
let me know
Thanks
-
You mean something like this?
Code:
Dim LastControl As String
Private Sub Command1_Click()
MsgBox LastControl
End Sub
Private Sub Command2_LostFocus()
'Store Command2 in LastControl
LastControl = Command2.Name
End Sub
Private Sub Picture1_LostFocus()
'Store Picture1 in LastControl
LastControl = Picture1.Name
End Sub
-
YES . you understand
yes , you understand correctly LAFOR .
(sorry. my explanation is very confusing)
-
thank you fo your answer megatron
can't I use control's collection to find last focused item.