group 4 Flashcards
a way for your program to respond to user actions, like clicking a button or typing text
Event handling in Windows Forms
is the mechanism that controls the event and decides what should happen if an event occurs
Event Handling
This mechanism have the code which is known as event handler that is executed when an event occurs
Event Handling
In simple terms, event handling is like
setting up a cause and effect: “When the user does this (cause), the program should do that (effect).”
Event Handling allows your application to interact with users in a ___, making it ___ to their actions.
dynamic way; responsive
refer to actions or occurrences, like a user pressing a key, clicking a button, moving the mouse, or system-generated notifications
Events
Applications respond to these events when they happen
Events
For instance, clicking a button or entering text in a box triggers an event, which can…
call a function or cause another event
Example:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MessageBox.Show("Button was clicked!")
End Sub
common types of events: (5)
Keyboard/touch events
Click events
Mouse hover events
Form/submit events
Drag and drop events
Triggered by pressing or releasing keys on a keyboard or interacting with a touch-enabled device
Keyboard/touch events
Occur when a user clicks on an element
Click events
Activated when a user moves the mouse or scrolls
Mouse hover events
Triggered by submitting, modifying, or resetting a form
Form/submit events
Happen when a user drags and drops elements on a page
Drag and drop events