From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add click event handler code

Add click event handler code - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Add click event handler code

- [Instructor] Because of the way Windows works you won't put the VB code in sub main. Instead WPF and the other desktop UI tools have the concept of event driven code. What does that mean? When the user interacts with the UI by clicking on the button, that raises an event. We create code blocks that are triggered by the event, so when the click event happens our click event code runs. When a text changed event happens a different bit of code runs. To work with these controls we need to know their name, so I'll select one of the controls and check out what it says down here in the XAML. The name of this is button. For the text box the name is text box. You can also see that over here. You want to guess what the name for the text block is? You got it, text block. Now you can change this to names that make more sense to your code and your application. For instance, I could call this the output the date button, so I can…

Contents