ProcessCmdKey Double Firing


C

Craig Bennett

I have some code to capture command keys. When I type
into a text box, the code runs once. When I type into a
combobox, the code runs twice. Can anyone explain this
behaviour to me? Here is the code which is in my form:

Protected Overrides Function ProcessCmdKey(ByRef msg
As _
System.Windows.Forms.Message, ByVal keyData As
System.Windows.Forms.Keys) As _
Boolean

Const WM_KEYDOWN As Integer = &H100

Dim blnHandled As Boolean = False

If msg.Msg = WM_KEYDOWN Then
Label1.Text = keyData.ToString & ":" &
Label1.Text
End If
blnHandled = MyBase.ProcessCmdKey(msg, keyData)

Return blnHandled
End Function
 
Ad

Advertisements

Joined
Jun 13, 2012
Messages
1
Reaction score
0
You need to return true if u process the message
else the same as u done.
i.e
blnHandled = MyBase.ProcessCmdKey(msg, keyData)
Return blnHandled
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top