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.

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.