3.2 VB.NET Events. An Event Procedure Properties and Event Procedures of the Form Tab Order of Controls Exercises. An Event Procedure. An event is an action, such as the user clicking on a button Usually, nothing happens until the user does something and generates an event.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Demo – Sales Order app with no code
controlName.property = setting
txtBox.ForeColor = Color.Red
Note: Right side is always assigned to left side
Demo: blank sol’n
Note: Can be named anything but this is a convention
Ensure your naming is intuitive!
Private SubobjectName_event(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles objectName.event
Shown in the book as:
Private SubobjectName_event(…) HandlesobjectName.event
Each object has default event procedure – double click it
you are unsure – try a label, textbox, button and listbox
Private Sub objectName_event(...)
Sometimes there are multiple actions that can
trigger an event – e.g. Textbox.enter event
Automatically pops up to give the programmer help.
Demo: wrong spelling for a control
Private Sub txtFirst_TextChanged(...)
txtFirst.ForeColor = Color.Blue
Private Sub btnRed_Click(...)
txtFirst.ForeColor = Color.Red
Private Sub txtFirst_Leave(...)
txtFirst.ForeColor = Color.Black
Private Sub txtBox_MouseHover ….
txtBox.BackColor = Color.AliceBlue
Private Sub txtBox_MouseLeave ….
txtBox.BackColor = Color.White
Form1.Text = "Demonstration"
Me.Text = "Demonstration"
Private Sub btnOne_Click(...) Handles btnOne.Click
Private Sub ButtonPushed(...) Handles btnOne.Click
Private Sub ButtonPushed(...) Handles btnOne.Click, btnTwo.Click
Do #37 together & #38 aloneHomework - #46 – page 74
Solutions to odd numbers are in the back of text book – try some on your own!