How remove System.Windows.Forms.TextBox, Text: from output of text box

sorry if its been asked i couldn’t find answer anywhere, New to this and forms … Im creating a form with text boxs but they always include the “System.Windows.Forms.TextBox, Text:” in front of the value

when i click button i output the value for the “Title” text box on form
$Clicked_Scheduled_Tasks = {
[System.Windows.Forms.MessageBox]::Show("$Title")
}
using the PSSCRIPTPAD not sure how to get that off the output values (ive tried $Title.text as other online suggestions but it just adds .text to the end of my value)

is there a setting on form designer im missing?

@Bento
in order to get the value of a text box you need to use the following

New-UDTextbox -Id "test" -Placeholder "Type Required Text" -Type text

New-UDButton -Text "Button"  -onClick {

$Text = (Get-UDElement -Id "test").Value

Show-UDToast -Message "$Text"

}
1 Like

do i add that on the test.ps1 that is created? here screenshot of example:
test.ps1 under the “Clicked” that it adds?

when clicking Button1 just wanting the texted entered in the text field above to pop up

@wsl2001 - It’s WinForms and not PSU but thanks for jumping in.

@Bento - Give this a go.

Add-Type -AssemblyName System.Windows.Forms 
. (Join-Path $PSScriptRoot 'test.designer.ps1')
$Clicked = {
    [System.Windows.Forms.MessageBox]::Show($Textbox.Text)
}
$Form1.ShowDialog()

My bad i thought its a PSU Q. Thanks

1 Like

almost, was able to get it needed to add single quotes on $TestBox1.Text and it worked thank yall

Add-Type -AssemblyName System.Windows.Forms
. (Join-Path $PSScriptRoot 'test.designer.ps1')
$Clicked = {[System.Windows.Forms.MessageBox]::Show('$TextBox1.Text')
}
$Form1.ShowDialog()
1 Like