[ad_1]
I have the TextBox
$textBox1 = New-Object System.Windows.Forms.TextBox
$textBox1.Location = New-Object System.Drawing.Point(10,40)
$textBox1.Size = New-Object System.Drawing.Size(260,20)
$form.Controls.Add($textBox1)
.
.
$x = $textBox.Text
and want to include my hash table in a way the input of the TextBox corresponds to values in it.
For example :
$hash = @{
A1 = "Stick"
A2 = "Leaf"
A3 = "Tree"
}
When I type A1 into the TextBox I want it to output ‘stick’.
Previously, I used
do {
$computer = $null
$choice = [Microsoft.VisualBasic.Interaction]::InputBox('Type the name of a computer','Test')
# exit the loop if the user cancels the box or clicks OK with an emty value
if ([string]::IsNullOrWhiteSpace($choice)) { break }
$computer = $hash[$choice]
} until ($computer)
But I haven’t figured out how to implement
$choice into the script to output it correctly
help much needed
[ad_2]