Add-Type -AssemblyName System.Windows.Forms
$frm1 = New-Object System.Windows.Forms.form
$frm1.Name = "Hey"
$flw1 = New-Object System.Windows.Forms.FlowLayoutPanel
$flw1.flowdirection = 'TopDown'
$frm1.controls.add($flw1)
$m = "apple","orange","banana"
for($i=0;$i -le $m.Length-1;$i++){
$lb = New-Object System.Windows.Forms.linkLabel
$lb.text = $m[$i]
$m[$i] = $null
$flw1.Controls.Add($lb)
$lb.add_Click({Write-Host $lb.text})
}
$frm1.showdialog()
Could someone please help me with a method to return the value of the label that was clicked? Or a means to identify which linklabel was clicked. Thank you.↧
Powershell - Help with returning dynamic variable values
↧