34,333
edits
Changes
→Windows PowerShell WinForms Events
</pre>
Using scriptblocks would quickly become unwieldy if all the code to be executed has had to be included along with the add_<eventname> method. An alternative to this approach is to call a function instead. The following adaptation of our example defines a function called ''do_exit'' and subsequently references it in the event handler scriptblock:
<pre>
$form.ShowDialog()
</pre>
== Setting WinForms Properties ==