How to tell absolute location of a control?

  • Thread starter Thread starter cgchris99
  • Start date Start date
C

cgchris99

Guest
I am trying to get the location of a textbox when someone clicks on it.

So I assumed it would be textboxname.top or textboxname.location.y
However, this is relative position to the control it resides in. So if it is in a tab. The Y location is much smaller than it is in relationship to the overall form.

I need to know absolute Top in relationship to the form itself.


Thanks for any help
 
Use the PointToClient() and PointToScreen() methods of the form, and the textbox, respectively. Or just add the coordinates to the those of the tab it's on, and any other container controls.
 
Back
Top