Dear Matteo & All others,
******** ENJOY THE FOLLOWING CODE **********
Regards,
Arif
=====================================================================
Option Explicit On
Imports System
Imports System.Windows.Forms
Imports owf = OpenNETCF.Windows.Forms
Imports mwf = Microsoft.WindowsCE.Forms
Public Class myKeyClass Implements owf.IMessageFilter
Overridable Function PreFilterMessage(ByRef m As mwf.Message) As
Boolean Implements owf.IMessageFilter.PreFilterMessage
Try
Dim key As Integer = m.WParam.ToInt32()
Select Case CType(m.Msg, owf.WinMsg)
Case owf.WinMsg.WM_CHAR
Select Case key
Case 9 'TAB key pressed
MsgBox("TAB key pressed")
Return True
Case 13 'ENTER key pressed
MsgBox("ENTER key pressed")
Return True
End Select 'key
End Select 'm.Msg
Return False
Catch ex As Exception
Return False
MsgBox(ex.ToString)
End Try
End Function
End Class
======================= Usage of above class =======================
Option Explicit On
Imports OpenNETCF.Windows.Forms
Public Class AppExTest
Inherits System.Windows.Forms.Form
Private objMyKeyClass As New myKeyClass
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
ApplicationEx.AddMessageFilter(objMyKeyClass)
'Add any initialization after the InitializeComponent() call
End Sub
#End Region
Public Shared Sub Main()
ApplicationEx.Run(New AppExTest)
End Sub
Private Sub AppExTest_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
TextBox1.Text = ""
TextBox1.Focus()
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
ApplicationEx.RemoveMessageFilter(objMyKeyClass)
ApplicationEx.Exit()
End Sub
End Class
"Matteo Cima" <mdm.list is_the_username @digisoft.it is_the_domain> wrote