if you use it on the combo iself it wil work (i use that a lot)
Private Sub cboLijn_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles cboLijn.KeyPress
if you want the form keypress events i suggest you use this (from the 'enter
key' thread tnx to the ppl that replied there :)
Turn "KeyPreview ON" for the form before your try this code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Enter Then
If Not ActiveControl Is Nothing Then
SendKeys.Send("{TAB}")
End If
End If
End Sub
"Vadim Rapp" <vr@myrealbox.nospam.com> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl...
Hi:
On my form, I have textbox and combo box. Form's KeyPreview = True. It
does work for the textbox, but not for the combo. I.e.
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
me.Text = e.KeyChar
End Sub
does intercept keys pressed in the textbox, but not in the combobox. Is
there any explanation for this?
thanks,
Vadim