Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which Control Caused Event?

Status
Not open for further replies.

wyoung71

Programmer
Sep 17, 2008
13
0
0
I was wondering if there is anyway to tell which control caused my function to fire up?

Basically I have a TextBox that has an OnDoubleClick Event. I have set the event to fire up a procedure in a module. So is there anyway of dicerning which textbox was clicked without specifically passing it as a parameter to the module.

What I'm trying to accomplish is I have a form that opens up on Double click but I also want to have the same form available on a shortcut menu when the user right clicks the textbox.

Any thoughts?

Thanks,
Bill
 
Have a look at the ActiveControl and PreviousControl properties of the Application.Screen object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV,
Thanks you're a life saver! Was banging my head trying to figure it out. Heres the acutal code snippet I used.

Application.Screen.ActiveControl.ControlName

The ControlName actually doesn't pop up but if you add a watch to the Application.Screen and drill down on the properties the ActiveControl.ControlName reveals the name of the control.

Again thanks,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top