Search found 4 matches

by mavis99
Tue Apr 09, 2019 2:00 am
Forum: PowerShell GUIs
Topic: Clear all textboxes in a form
Replies: 4
Views: 678

[SOLVED] Clear all textboxes in a form

Got it:

Code: Select all

$tabpage1.Controls | Where-Object{ $_ -is [System.Windows.Forms.Textbox] } | ForEach-Object { $_.clear() }
Thanks for your support :)
by mavis99
Tue Apr 09, 2019 1:31 am
Forum: PowerShell GUIs
Topic: Clear all textboxes in a form
Replies: 4
Views: 678

Re: Clear all textboxes in a form

maybe the problem is, that all of my textboxes are within a tabcontrol
by mavis99
Tue Apr 09, 2019 1:28 am
Forum: PowerShell GUIs
Topic: Clear all textboxes in a form
Replies: 4
Views: 678

Re: Clear all textboxes in a form

Thanks for your quick response :)
If I write a raw PS1 script, then your script runs as expected.
But if I use the Sapien Designer (Powershell Studio 2019 v5.6.160) and double click my button and add your script nothing happens.
by mavis99
Mon Apr 08, 2019 11:59 pm
Forum: PowerShell GUIs
Topic: Clear all textboxes in a form
Replies: 4
Views: 678

Clear all textboxes in a form

Hi, I have a form with 10 textboxes. With a button i want to clear all of them: $button_Click={ foreach ($tb in (Get-Variable | where { $_.value -is [System.Windows.Forms.Textbox] })) { $tb.Text = "" } } The problem is, that $tb.Text is not an allowed option for this object, ironically $tb.Name is a...