Sender
Previous Top Next

Access the control that raised the event.
Sender keyword is useful when two or more controls events are wired to the same sub (using AddEvent).
Syntax: Sender
You can use Sender just like any other control name using the following properties:
Text, Left, Top, Width, Height, Visible, Enabled, Focus, BringToFront, Color, FontColor, FontSize, Refresh, Dispose, Name, Image, Checked, IgnoreKey, SelectionLength, SelectionStart, ScrollToCaret, Multiline and LoadPicture.

For other properties you should use Control(Sender,Type) where type is the sender's type.
Note that Sender returns only the name without the module. Therefore using Control keyword together with Sender will fail if the control belongs to a different module.
For that reason SenderFullName is preferred over Sender.
Example:
Sender.Text = "Hello"

If you omit the property after Sender then it will return the controls name (lower cased).
Example:
Msgbox (Sender) 'will display the control's name.