# Re: 请问form 中的每一个 control 如何知其 name ?

Posted by 小瓜瓜 on August 15, 1999 at 00:27:38:

In Reply to: Re: 请问form 中的每一个 control 如何知其 name ? posted by 纪文和 on August 10, 1999 at 19:43:37:

: : 请问form 中的每一个 control 如何知其 name ?
: : 例如我有三个 control 其 name 分别为 txtemp_no,cmdok, cmdcancel
: : 想当 mouse 停在某一 control 时知道其 name 为何 ?

: 您说的当 mouse 停在某一 control 是指 MouseMove(只是经过) 还是已经 click(已经点下去) ? 有差别的 !!

: 若是已经 click 就很简单, 只要用 ActiveControl.Name 即可.

: VB入门网

可以使用MouseMove事件
当你的滑数要移到某物件上停住，一定会呼叫该物件的MouseMove事件

(General)
Dim WhereControlIAm As String

Private Sub Form1_MouseMove(Button As Integer ,.......)
WhereControlIAm = "Form1"
End Sub

Private Sub txtemp_no_MouseMove(Button As Integer ,.......)
WhereControlIAm = "txtemp"
End Sub

Private Sub cmdok_MouseMove(Button As Integer ,.......)
WhereControlIAm = "cmdok"
End Sub

Private Sub cmdcancel_MouseMove(Button As Integer ,.......)
WhereControlIAm = "cmdcancel"
End Sub

Follow Ups: