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 » Fri Sep 28, 2018 9:59 am

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

User avatar
jvierra
Posts: 13506
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: The xml was improperly formatted.

Post by jvierra » Fri Sep 28, 2018 10:08 am

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.

User avatar
jvierra
Posts: 13506
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: The xml was improperly formatted.

Post by jvierra » Fri Sep 28, 2018 10:11 am

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