Catching the Smartphone back and softkeys in managed code

Someone asked in over the weekend about the correct way to trap the back key when writing a managed application for Smartphone devices. Ali responed with a link to a great article on gotdotnet that walks through the process.

Basically, you add an event handler for the KeyPress event of your form. If the keycode is 27 (the escape key) then the back key was pressed. Similarly, if the key was Keys.F1 or Keys.F2, the left or right softkey respectively was pressed.

[Author: Neil Enns]