The xml was improperly formatted.

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
aartogba
Posts: 15
Last visit: Tue Jan 23, 2024 8:00 am

Re: The xml was improperly formatted.

Post by aartogba »

Ok, but is there a workaround to detect if the backspace key has been pressed?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: The xml was improperly formatted.

Post by jvierra »

Code: Select all

    if($_.KeyChar -eq [System.Windows.Forms.Keys]::Back){
        Write-Host 'Backspace'
    }
Use this to see that the backspace key is detected. The issue with the display has no effect on the code.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: The xml was improperly formatted.

Post by jvierra »

This will show you the keychar value.

Code: Select all

$textbox1_KeyPress=[System.Windows.Forms.KeyPressEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.KeyPressEventArgs]
    if($_.KeyChar -eq [System.Windows.Forms.Keys]::Back){
        Write-Host 'Backspace' ([int]($_.KeyChar))
    }
}
This topic is 5 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked