O'Reilly logo

Learn PowerShell Toolmaking in a Month of Lunches by Don Jones and Jeffrey Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

25.2. Creating a form for output

If you choose not to use Out-GridView, or if it isn’t suitable for your needs, then you’ll need to “roll your own” output form. To continue our example, we’re going to comment out the Out-GridView command in our OK button’s event handler:

$OKButton_Click={
    if ($EventLogName.Visible) {
        # retrieve event log
        if ($EventLogName.SelectedIndex -gt -1) {
            $entries = Get-EventLog -Computer $ComputerName.Text `
                                    -Log $EventLogName.SelectedItem
            # $entries | Out-GridView } } else { # populate event log list $logs = Get-EventLog -ComputerName $ComputerName.Text ` -List | Select-Object -ExpandProperty Log Load-ComboBox -ComboBox $EventLogName ` -Items $logs $EventLogName.Visible = $true $labelSelectEventLog.Visible = $true ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required