Private Sub Command1_Click()
On Error Resume Next
Print Command1.Name
Print Command1.Index '非控件数组此属性无值,读值会出错
Print Me.Name '当前窗体名称,既然有点击动作,点击的控件肯定属于当前窗体
End Sub
Private Sub Command1_Click(Index As Integer)
Print "ctl name:" & Command1(Index).Name(有点傻,张三的名字)
Print "ctl index:" & Index
Print "form caption:" & Me.Caption
Print "form name:" & Me.Name
End Sub
Private Sub Command1_Click(Index As Integer)
MsgBox ActiveControl.Name
MsgBox ActiveControl.Caption
MsgBox ActiveControl.Index
End Sub
不是有属性窗口吗?有名称,caption属性是控件上显示的,其他自己找找!