![]() |
A way refer to a control itself in an event handler
Hi all,
I have 60 controls on a form, and every control will handle an event in the same way, so I decide to abstract the process into a sub and make the sub call with corresponding control. If I can refer to the control itself in its event handler then the calling process will be same across all controls handlers. Could you tell me a way to refer to a form's control itself in one of its event handler , for example, Private Sub txtEI3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ' here I hope to refer to the control txtEI3 in a generic way like Me because 'there will be universal sub call using the control as parameter like ' FillDate Thiscontrol End Sub Clara thank you so much for your help |
A way refer to a control itself in an event handler
You will need to this with a Class.
Plenty of examples available. RBS "clara" wrote in message ... Hi all, I have 60 controls on a form, and every control will handle an event in the same way, so I decide to abstract the process into a sub and make the sub call with corresponding control. If I can refer to the control itself in its event handler then the calling process will be same across all controls handlers. Could you tell me a way to refer to a form's control itself in one of its event handler , for example, Private Sub txtEI3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ' here I hope to refer to the control txtEI3 in a generic way like Me because 'there will be universal sub call using the control as parameter like ' FillDate Thiscontrol End Sub Clara thank you so much for your help |
All times are GMT +1. The time now is 11:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com