473,388 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

KeyPreview does not intercept keys in Combo Box

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

Nov 20 '05 #1
3 2333
* "Vadim Rapp" <vr@myrealbox.nospam.com> scripsit:
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?


Which version of .NET do you use? AFAIK this is a bug in .NET 1.0.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
HKW> Which version of .NET do you use? AFAIK this is
HKW> a bug in .NET 1.0.

1.1.4322

Vadim
Nov 20 '05 #3
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

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Carl Tribble | last post by:
I am using KeyPreview on the form to trap Function-keys. My form includes a datagrid. I am using the Form.KeyDown event to trap the keys and all works fine unless the datagrid is showing one or...
1
by: Ori | last post by:
Hi Guys, Here is my problem, but maybe someone can help me with this. Background: 1. Using C#. 2. I'm having a form which the KeyPreview is on (and must stay like this) and I'm...
1
by: ray well | last post by:
hi, i need to preview the keys in my app in order to process F1-F10. i set keypreview of my form to true, and it does capture the keystrokes from all over the forms controls which i then...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
13
by: HABJAN ®iga | last post by:
I'am using form's keypreview property & keydown (on form) to look for hotkeys (alt+?) Everything works fine, except when i have focus on combobox. Then the event on form isn't raised. Can...
9
by: Charles Law | last post by:
I have asked a similar question to this before, but have not found a satisfactory answer yet, so I thought I would ask it in another way. KeyPreview, for a form, handily allows keys to be...
0
by: ray well | last post by:
hi, i need to preview the keys in my app in order to process F1-F10. i set keypreview of my form to true, and it does capture the keystroke which i can process. if the user types into the...
1
by: Lou | last post by:
I have an activeX control in my .NET app that steels the "Delete" key, How can I Steel the key first. I tried the KeyPreview but that doesn't get the key first. -Louie
115
by: LurfysMa | last post by:
Most of the reference books recommend autonum primary keys, but the Access help says that any unique keys will work. What are the tradeoffs? I have several tables that have unique fields. Can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.