Typically used to signal user actions such as button clicks or menu selections in graphical user interfaces
When an event has multiple subscribers, the event handlers are invoked synchronously when an event is raised
For example, when a user clicks a control on a form, the form can raise a Click event and call a procedure that handles the event
Event Handler
Is a function or method containing a program statement that is executed in response to the event
Event
Is the action done using an input device
Event Handler
Is the interpretation of the event, the response, the reaction and the action triggered due to the event
Some events
Change
Click
DblClick
DragDrop
DragOver
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown
MouseMove
MouseUp
Click Event
Gets activated when a button is clicked on
Object keyword
The object that activates the event, placed in variable named sender
ToString method
Used on the sender variable
EventArgs e
The other argument in between the round brackets, considered as short for event arguments
MouseDown Event
Recognizes which button of the mouse is pressed
Events or Bolt icon is the properties window
Code Stub
Automatically generated framework of a code procedure to be developed based on the event
Event Handler
This is the function or method containing a program statement that is executed in response to the event. It is usually a software routine that will process actions such as a keystroke and mouse movement.
GotFocus
This event when an element has the focus either by stop or the mouse pointer is hovering about the element.
Click
This event when the user selects an element using the primary mouse button
Change
This event occurs when the user edits the text displayed in the text box and combo box.
MouseDown
This event occurs when the user clicks a mouse button while the mouse pointer is over an object.
Events
These are built-in codes that get activated when a user performs an action on an object using any input device.
KeyDown
This event occurs when a key is pressed while the element has the focus.
KeyPress
This event occurs when key is pressed and released while the lament has the focus
Double-Click
This event occurs when you point at an element then clicking in quick succession the primary mouse button.
Code Stub
This is an automatically generated framework of a code procedure to be developed based on the event.
Change
occurs when the user edits the text displayed in the text box and combo box.
Click
occurs when the user clicks/selects an element using the primary mouse button.
DblClick
occurs when the user double-clicks an element using the primary mouse button (pointing at an element then clicking the primary mouse button in quick succession)
DragDrop
occurs when the user drags (click, hold, and move to the desired location then release) an element to another location.
DragOver
occurs when the drags (click, hold and move over) an element over another control.
GotFocus
occurs when an element has the focus either by tab stop or the mouse pointer is hovering above the element.
KeyDown
occurs when the key is pressed while the element has the focus.
KeyPress
occurs when a key is pressed and released while the element has the focus.
KeyUp
occurs when a key is released while the element has the focus.
LostFocus
occurs when an element loses the focus.
MouseDown
occurs when the user clicks a mouse button while the mouse pointer is over an object.
MouseMove
occurs when the user moves the mouse over an element.
MouseUp
occurs when the user releases a mouse button while the pointer is over an object.
ToString example?
MessageBox.Show(sender.ToString());
Message displays which object was the sender of the event and displays the text property of the sender.