Files
Intune/dump/SCCM-Tool/Forms/Form-Examples/Combobox-Final-2.ps1

219 lines
6.6 KiB
PowerShell

#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: b24654a3-c952-4b96-8e01-c56d9800c4a7
# Source File: FirstForm4-tabs.psf
#------------------------------------------------------------------------
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
UwsAAB+LCAAAAAAABADFVl1vmzAUfZ+0/2DxzELIR9NIBKkhjVStXasl6/ZWGbhJvBo7sk0T9utn
B5Lla4VKaSokBPY5Pvf6XF/wvkPEX0BkA6ww0g+ScNazGjXX8j9/Qsi7F2RKGKZDQuEbTsAfEiHV
kIuk9UXhUNbmcuI5B6icG/6GSCGVzaFnjTKpIKn9JCzmC1kzK+R3Gx2bstFjEUyrVjeXjYKUqlRA
j0GqBKY2ekhDSqKvkI35M7Be2OngdtS+cLvNFtQvuxZiOpSeNdHruRaKZoTGQuOsgDMlOJV5ijrQ
B8HnIFRWEK5SxUcRpjAgCTAThIZe2Mhtes4aWka94zFY/lArlXICSoCpEfmjCd22TvSi1SolmV22
/FVqpdgxLJWJRSSH0OsXrV3gbjmOizWfzLPnrGbX0HI7A56EvM+X725pZIRCvnzV1iPuUMoXAz1m
+WORwsFuHDJM4FgpwqbXDIcU4srMG53/VigaYEZ2d2+khF7ZRomMuKAkPMUO+fdMh2e0PkB7vOAf
pz0TsJ95BZ9ueYSVlrZ8t3Wpz16nAucOL00VDfiCFTY36hVo+Znd1G4FRt4U3IZro0YV/BiHNyyG
peYcQ28f9hFQfZohXuGDGWZTU9yb4J6Oze81BCfvCNX7Qz9VirN37w7hSuaNveFfHTTr3Yp1kBta
yFW2s9PWbh5+Sl5zs0p15V2+ejA/JDwSmWI6UhmFPo6eA065+E+D2zF79+VKSki0MSDX2GIk8094
wD1ns+q+Sl5O59A4ecmWK5ofs/MICbxYdeW3a9Wbk/akM3HduF3HTVyu9SuhZ8kp4AJOL7R5zUve
c7Z/ov2/L8SajlMLAAA=#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.124
Generated on: 7/21/2016 3:30 PM
Generated by: administrator
--------------------------------------------------------------------------------
.DESCRIPTION
GUI script generated by PowerShell Studio 2016
#>
#----------------------------------------------
#region Application Functions
#----------------------------------------------
#endregion Application Functions
#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function Call-FirstForm4-tabs_psf {
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$form1 = New-Object 'System.Windows.Forms.Form'
$combobox1 = New-Object 'System.Windows.Forms.ComboBox'
$button1 = New-Object 'System.Windows.Forms.Button'
$button_ComboBoxSelection = New-Object 'System.Windows.Forms.Button'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
$TextBox_Display = New-Object 'System.Windows.Forms.TextBox'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
$combobox1_SelectedIndexChanged={
#TODO: Place custom script here
}
$form1_Load={
#TODO: Place custom script here
}
$button1_Click={
#TODO: Place custom script here
Ba
}
$button_ComboBoxSelection_Click={
$TextBox_Display.text = $Combobox1.SelectedItem
}
$TextBox_Display_TextChanged={
}
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$form1.WindowState = $InitialFormWindowState
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$combobox1.remove_SelectedIndexChanged($combobox1_SelectedIndexChanged)
$form1.remove_Load($form1_Load)
$form1.remove_Load($Form_StateCorrection_Load)
$form1.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch [Exception]
{ }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$form1.SuspendLayout()
#
# form1
#
$form1.Controls.Add($combobox1)
$form1.Controls.Add($button1)
$form1.Controls.Add($button_ComboBoxSelection)
$form1.Controls.Add($TextBox_Display)
$form1.AutoScaleDimensions = '6, 13'
$form1.AutoScaleMode = 'Font'
$form1.ClientSize = '950, 644'
$form1.Name = 'form1'
$form1.Text = 'Form'
$form1.add_Load($form1_Load)
#
# combobox1
#
$combobox1.AllowDrop = $True
$combobox1.FormattingEnabled = $True
#$combobox1.Items.AddRange("")
<#
[void]$combobox1.Items.Add('One')
[void]$combobox1.Items.Add('Two')
[void]$combobox1.Items.Add('Three')
#>
#
#
$TextBox_Display.Location = '278, 120'
$TextBox_Display.Name = 'VCenterUserPassword'
$TextBox_Display.Size = '132, 20'
$TextBox_Display.TabIndex = 8
$TextBox_Display.add_TextChanged($TextBox_Display_TextChanged)
#
$combobox1.Location = '148, 67'
#$combobox1.MaxDropDownItems = 20
$Combobox1.Text="- Select -"
$combobox1.Name = 'combobox1'
$combobox1.Size = '121, 21'
$combobox1.TabIndex = 1
$combobox1.add_SelectedIndexChanged($combobox1_SelectedIndexChanged)
#
# button1
#
$button1.Location = '309, 67'
$button1.Name = 'button1'
$button1.Size = '75, 23'
$button1.TabIndex = 0
$button1.Text = 'button1'
$button1.UseVisualStyleBackColor = $True
$form1.ResumeLayout()
$button1.add_Click($button1_Click)
#endregion Generated Form Code
#
# button_ComboBoxSelection
$button_ComboBoxSelection.Location = '309, 40'
$button_ComboBoxSelection.Name = 'button_ComboBoxSelection'
$button_ComboBoxSelection.Size = '75, 23'
$button_ComboBoxSelection.TabIndex = 1
$button_ComboBoxSelection.Text = 'Select Item'
$button_ComboBoxSelection.add_Click($button_ComboBoxSelection_Click)
#
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$form1.add_FormClosed($Form_Cleanup_FormClosed)
#Show the Form
return $form1.ShowDialog()
} #End Function
Function Ba {
#$combobox1.Items.Add('a')
$combobox1.Items.Clear()
$P = Get-Process | select -ExpandProperty ProcessName
$P | % { $combobox1.Items.Add($_) }
}
#Call the form
Call-FirstForm4-tabs_psf | Out-Null