Im really embarrassed asking this, but I have a script which I'm trying to make it look better, and less repetetive.
It has the following lines:
$textbox41.Add_Click({if ($Box41Trigger){$textbox41.text = ""; $textbox41.ForeColor="black";$script:Box41trigger=$false}})
$textbox42.Add_Click({if ($Box42Trigger){$textbox42.text = ""; $textbox42.ForeColor="black";$script:Box42trigger=$false}})
$textbox43.Add_Click({if ($Box43Trigger){$textbox43.text = ""; $textbox43.ForeColor="black";$script:Box43trigger=$false}})
You can see those 3 lines are repetitive only changing 41, 42, 43 etc. in two locations.
How can I make it look better? it looks so bad.