Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Select all Button

$
0
0

Hallo,

ich habe eine Funktion die ein Auswahl Fenster erstellt und verschiedene Inhalte zur Auswahl zur Verfügung stellt.

Nun suche ich eine Möglichkeit einen Button zu erstellen, der alle Punkte die zur Auswahl stehen auswählt.

function Select-Item($MyGroups)
{	[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
	$dlg = New-Object System.Windows.Forms.Form
    $dlg.StartPosition = "CenterScreen"
    $dlg.Size = New-Object System.Drawing.Size(650,400)
	$dlg.Text = "alt: $_old - neu: $_new"

	$panel = New-Object System.Windows.Forms.FlowLayoutPanel
	$panel.Height = 50
	$panel.Dock = "Bottom"
    $panel.FlowDirection = "RightToLeft"

	$cancel = New-Object System.Windows.Forms.Button
	$cancel.Text = "Cancel"
	$cancel.DialogResult = "Cancel"

	$ok = New-Object System.Windows.Forms.Button
	$ok.Text = "OK"
	$ok.DialogResult = "OK"

	#$panel.Controls.Add($all)
	$panel.Controls.Add($cancel)
	$panel.Controls.Add($ok)

	$list = New-Object System.Windows.Forms.CheckedListBox
	$list.Dock = "Fill"
	$list.DisplayMember = $displayMember
	$list.IntegralHeight = $false
	$list.CheckOnClick = $true

	$dlg.Controls.Add($list)
	$dlg.Controls.Add($panel)
	$items = $MyGroups.name
	$list.Items.AddRange($items)
	$list.Sorted = $true

	$result = $dlg.ShowDialog()
	if ($result -eq "OK")
	    {
		return $list.CheckedItems
	    }
}

Kann mir da jemand helfen?

Liebe Grüße

Norbert


IT Berater


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>