Home > Archive > Smartphone Developer Forum > February 2005 > VB.NET code to capture BACK BUTTON on Smartphone?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
VB.NET code to capture BACK BUTTON on Smartphone?
|
|
| sagewithin 2005-02-13, 9:00 pm |
| Can anyone provide some VB.NET code for how to capture the BACK BUTTON on a
Smartphone? Any help would be greatly appreciated. Basically, I'm trying to
do some custom things when the user presses the back button within my
application.
Thanks!
| |
| Brian Cross \(MSFT\) 2005-02-14, 9:01 pm |
| the Back Button on Smartphone is the Keys.Escape key.
In the list of events for your Form, choose the KeyPressed event.
The following code will show a MessageBox when the back button is pressed
(instead of navigating back):
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
' the Escape key is the back button on Smartphone
If e.KeyChar = ChrW(Keys.Escape) Then
e.Handled = True ' this says we handled the key, otherwise we will
navigate.
MessageBox.Show("Back button was pressed")
End If
End Sub
--
Brian Cross
Developer Experience, Windows Mobile
This posting is provided AS IS with no warranties, and confers no rights.
"sagewithin" <sagewithin@discussions.microsoft.com> wrote in message
news:A8F3AA64-312B-4F42-B598-70F873163D37@microsoft.com...
> Can anyone provide some VB.NET code for how to capture the BACK BUTTON on
> a
> Smartphone? Any help would be greatly appreciated. Basically, I'm trying
> to
> do some custom things when the user presses the back button within my
> application.
>
> Thanks!
>
| |
| sagewithin 2005-02-15, 4:04 am |
| Thanks a lot Brian. Works great.
"Brian Cross (MSFT)" wrote:
> the Back Button on Smartphone is the Keys.Escape key.
>
> In the list of events for your Form, choose the KeyPressed event.
> The following code will show a MessageBox when the back button is pressed
> (instead of navigating back):
>
> Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As
> System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
>
> ' the Escape key is the back button on Smartphone
> If e.KeyChar = ChrW(Keys.Escape) Then
> e.Handled = True ' this says we handled the key, otherwise we will
> navigate.
> MessageBox.Show("Back button was pressed")
> End If
>
> End Sub
>
> --
> Brian Cross
> Developer Experience, Windows Mobile
>
> This posting is provided AS IS with no warranties, and confers no rights.
>
> "sagewithin" <sagewithin@discussions.microsoft.com> wrote in message
> news:A8F3AA64-312B-4F42-B598-70F873163D37@microsoft.com...
>
>
>
|
|
|
|
|