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.
User avatar
phhebert
Posts: 15
Joined: Mon Sep 26, 2016 8:24 am

Re: The xml was improperly formatted.

Post by phhebert »

Ok, but is there a workaround to detect if the backspace key has been pressed?

jvierra
Posts: 14481
Joined: Tue May 22, 2007 9:57 am
Contact:

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: 14481
Joined: Tue May 22, 2007 9:57 am
Contact:

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))
    }
}

Locked