473,396 Members | 1,936 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,396 software developers and data experts.

UserControl enter key

I have a UserControl that contains a TextBox. I can't figure out how to
capture and process the Enter key.

I'm using the event code below...
private void txt_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == Keys.Return)
{
Blink(Color.Green, 10, 100);
}
}
in my properties I've tried both true and false conditions in
txt.AcceptsReturn
Nov 15 '05 #1
3 2778
per MSDN:

Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls automatically. In order to have these keys raise the KeyUp event, you must override the IsInputKey method in each control on your form. The code for the override of IsInputKey would need to determine if one of the special keys is pressed and return a value of true.

http://msdn.microsoft.com/library/de...keyuptopic.asp
Nov 15 '05 #2
per MSDN:

Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls automatically. In order to have these keys raise the KeyUp event, you must override the IsInputKey method in each control on your form. The code for the override of IsInputKey would need to determine if one of the special keys is pressed and return a value of true.

http://msdn.microsoft.com/library/de...keyuptopic.asp
Nov 15 '05 #3
Thanks for your help Jayson.

I saw that but can't get it to work. Not sure what's wrong but from what I
can see the txt_KeyUp event isn't even being handled in the UserControl.

"Jayson" <an*******@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
per MSDN:

Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls automatically. In order to have these keys raise the KeyUp
event, you must override the IsInputKey method in each control on your form.
The code for the override of IsInputKey would need to determine if one of
the special keys is pressed and return a value of true.

http://msdn.microsoft.com/library/de...keyuptopic.asp
Nov 15 '05 #4

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

Similar topics

10
by: Jeff | last post by:
I'm just starting to work with UserControls and have a question on the behavoir of exceptions within UserControls and VS.Net 2003. I have noticed that when a UserControl throws an exception from...
0
by: scott | last post by:
Ok....I'm really stumped on this one. I've got a webform with a usercontrol set in it. The usercontrol handles login and nav. things. In the UC(usercontrol) i have 3 textboxs and a label. The...
2
by: Carlo Marchesoni | last post by:
I have a UserControl that builds a Tree-View Menu using Javascript. This UC does not run as a ServerControl Then, in every aspx page I include this UC. Everything works perfect, except that if I...
1
by: Kepler | last post by:
I have a custom control that is thrown onto a UserControl that is thrown onto a WebForm. Basically, I've got a scenario where if my UserControl sets an attribute on the custom control in the ascx,...
2
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course...
2
by: Frank | last post by:
Hi! I have a really 'simple' problem. I have an .aspx page with 2 textboxes (login & password) and a Submit button. This works very well, i fill in my login and password and simply press the...
4
by: liups | last post by:
Hi, I have an array of usercontrols, each of the usercontrol has a label and a textbox, I want to do some checking when the textbox loses focus, the code is like this: Private Sub...
2
by: Simon Verona | last post by:
I have a usercontrol with code in the "leave" event which updates the final data back into a database. This works fine except if I have a default "accept" button on a form and invoke it by...
2
by: gerry | last post by:
based on MSPress's ASP.NET 2.0 Applications Advaced Topics ( Table 12-3 p.472 ), and most events should be automatically wired up when @Control AutoEventWireup="true". ie. Page_InitComplete() {}...
3
by: Simon Verona | last post by:
Sorry for the repost, but this group seems to be more "active" than the group that I posted my question, and it's probably as valid here as there! I have a usercontrol, which contains a textbox...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.