GUI Form Using PowerShell Add Panel, Label, Edit box, Combo Box, List Box, CheckBox and More!!!

Play GUI Form Using PowerShell Add Panel, Label, Edit box, Combo Box, List Box, CheckBox and More!!!
Sign in to queue

Description

Demonstrate how create and work with GUI Forms using PowerShell. Shows how to create Forms, add labels, text boxes, panels, combo boxes, Pick Lists, and more. Shows how to populate all fields including picklists and combobox lists and work with properties. Shows how to populate and work with array objects. Uses Azure commands to populate list data. Shows how to work with the results from the dialog and the changes made to the form objects.

 Please Click Play in video instead of following Links below

GUI Form, Panel, Label, Edit box, Combo Box, List Box, CheckBox and More!!!
[00:57] Where to get Script
[01:07] Create the form
[01:57] Access the Power of the .NET Framework
[02:32] Empty Form, Add Panel for Buttons
[02:58] Create Cancel Button
[03:14] Multiple commands on same line
[03:40] Create OK Button
[03:47] Add Buttons to Panel
[04:00] Add Panel to form
[04:30] Finalize Form, Show Dialog and evaluate result
[05:05] Seeing the form in action
[05:47] Add TextBox and Label
[07:02] Add and populate Listbox with Azure Location
[08:03] Object as Array; Populate Listbox Values
[09:37] Set Default "Selected" Value of Listbox
[10:45] Add Checkbox
[11:09] Add ComboBox and populate with Azure VM Template Images
[15:15] Finalize and show form
[16:16] Default Value Comparison for Lists
[18:15] Evaluating results of form and all fields
[19:32] Referencing Array based on Selected Item

Embed

Download

Download this episode

The Discussion

  • User profile image
    Leo Jensen

    Dansk er en betingelse

  • User profile image
    Weston

    I am having trouble with the Dropdown box array when trying to get list of items in the text. It just gives me options 1::, 2::, or 3::. My code is below. Any assistance would be great. Thanks in advance.


    ## Email Address Label
    $emaillbldropdown = New-Object System.Windows.Forms.Label; $emaillbldropdown.Text = "Email Address:"; $emaillbldropdown.Top = 100; $emaillbldropdown.Left = 5; $emaillbldropdown.Autosize = $true
    $form.Controls.Add($emaillbldropdown) # Add to Form
    ##Email Address Input
    $emailinputdropdown = New-Object Windows.Forms.ComboBox ; $emailinputdropdown.Top = 100; $emailinputdropdown.Left = 160; $emailinputdropdown.Width = 550
    Write-Host "Getting List of @ email addresses" (Get-Date) -ForegroundColor Green
    $ArrayEmail = Get-Content -Path 'C:\Users\Administrator\Desktop\NewHireScripts\Lists\EmailAddressList.txt' #Gets list of email address for domain
    [void] $emailinputdropdown.BeginUpdate() # This tells the control to not update the display while processing (saves time)
    $i = 0 ; $iSelect = -1
    foreach ($element in $ArrayEmail) {
    [void] $emailinputdropdown.Items.Add($thisElement)
    if ($element.label -eq "@ucbbank.com")
    {$emailinputdropdown.Text = $thisElement; $iSelect = $i } # Set Default $cbImage1.Text = $i.ToString() +"::" +$element.label
    $i ++
    }
    $emailinputdropdown.SelectedIndex = $iSelect # Set the default SelectedIndex
    [void] $emailinputdropdown.EndUpdate() # update the control with all the data that was added
    $form.Controls.Add($emailinputdropdown)
    Write-Host "Finished getting list of @ email addresses" (Get-Date) -ForegroundColor Green

Add Your 2 Cents