Page 2 of 2

Re: The xml was improperly formatted.

Posted: Fri Sep 28, 2018 9:59 am
by aartogba
Ok, but is there a workaround to detect if the backspace key has been pressed?

Re: The xml was improperly formatted.

Posted: Fri Sep 28, 2018 10:08 am
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.

Re: The xml was improperly formatted.

Posted: Fri Sep 28, 2018 10:11 am
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))
    }
}