From the course: Complete Guide to PowerShell 7
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Using event handlers - PowerShell Tutorial
From the course: Complete Guide to PowerShell 7
Using event handlers
- [Instructor] So now let's focus on the event handlers themselves. We've already touched on a couple of them, so let me just go ahead and populate the field here and just do Run Selection and that will define our form itself. Now, we can add a dynamic event handler for values that get typed into a specific text box, for example. So I'm choosing the TextBox option and I'm adding what's called a TextChanged event handler. So what that means is, is that as I type things, what's going to happen is, my FeedbackLabel, which I've just added, is going to say Hello, and then what we should see is the dynamic text appearing. So let's just add that as an event and then we'll say $form.ShowDialog() and run that selection. So I'm going to say Liam, and it instantly, it recognizes what we've typed (keyboard clacking) and whatever I type in there, it's going to be dynamically rendered. So we have this idea of a dynamic event handler that runs when text is changed or values are updated, instead of…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.