Sunday, November 7, 2021

Adding a Listbox into a Powershell GUI

 To add a listbox into the GUI of the form do the following:

$cmbClaimType = New-Object Windows.Forms.combobox
$cmbClaimType.Size = New-Object System.Drawing.Size(230,30)
$cmbClaimType.AutoSize = $false
$cmbClaimType.Location = New-Object Drawing.Point 440,100
$cmbClaimType.Font = New-Object System.Drawing.Font("Arial",10,[System.Drawing.FontStyle]::Regular)
$cmbClaimType.DropDownStyle = [System.Windows.Forms.ComboBoxStyle]::DropDownList

DropDownStyle has been set to a List so the users cannot add their own items

No comments: