I’m trying to output the value entered witin a textbox to HTML using PowerShell but i’m a little stuck. Here is my code:
$button1 = New-Object System.Windows.Forms.Button
$button1.Name = "button1"
$button1.Location = New-Object System.Drawing.Point(16, 350)
$button1.Text = "Create"
$button1.add_Click({ConvertTo-HTML -title "Email Signature" -body "<p>$textBox2.Text</p>"})
The resulting HTML is…
System.Windows.Forms.TextBox, Text: Chris.Text
How can I make the output simply be “Chris“?
Worked it out 🙂
The answer is: $($textBox2.Text)