how do I capture the control enter sequence in keydown or keypressed event?

G

GS

I was trying to catch the control enter key sequence of a combo box in the
keydown event, but I failed to se anything like control enter, neither Did I
find in keypresssed event

I tried google but no luck

Do I have to go down to the level of capturing control keydown/press with
time and then when enter key is pressed check the time? or is there some
easier way?
 
M

Martin Zugec

Ufff, could you be more specific?

It should work fine:

Public Sub ComboKeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
If e.KeyCode = Keys.Insert Then
' Do something
End If
End Sub
 
C

Chris Dunaway

Ufff, could you be more specific?

It should work fine:

Public Sub ComboKeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
If e.KeyCode = Keys.Insert Then
' Do something
End If
End Sub

Or this:

Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter AndAlso e.Modifiers = Keys.Control Then
'do something
End If
End Sub

Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
If (e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) AndAlso
Control.ModifierKeys = Keys.Control) Then
'do something
End If
End Sub

Chris
 

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