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

Enter Event + Shortcut

Hi, i want to ask view questions
1.when i press Enter button on the textbox
how do i trigger an event?

2.How do i use shortcut key for example ctrl+s to call
certain function.
Nov 16 '05 #1
1 4906
Hi Kimochi,

1. Capture the TextBox's KeyUp event and raise the event if the KeyCode is
Enter, something like this:

// Called from constructor
// EnterEvent += new EventHandler(EnterEventHandler);

private void textBox2_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
EnterEvent(this, EventArgs.Empty);
}
}

public event EventHandler EnterEvent;

private void EnterEventHandler(object sender, EventArgs e)
{
MessageBox.Show("You pressed the enter key in textBox2!");
}

2. You can add a menu with a menu item that has it's Shortcut property set
to CtrlS.

Joe
--
http://www.csharp-station.com

"Kimochi" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
Hi, i want to ask view questions
1.when i press Enter button on the textbox
how do i trigger an event?

2.How do i use shortcut key for example ctrl+s to call
certain function.

Nov 16 '05 #2

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

Similar topics

2
by: bullshark | last post by:
VSN03:C# Create a C# Windows Form project. Add two TextBox controls. From the Properties of each, add an Enter Event handler. In the generated Enter Event Handlers (textBox1_Enter &...
0
by: Ollie | last post by:
When a form has a default button (Form.AcceptButton) and\or a shortcut key for that button (e.g. "&Process") and this button happens to close the form when clicked. Why does the control that...
4
by: Sam | last post by:
Hi, This is driving me totally insane. I have two datagrid controls, and when I click on the first one its Enter event is called properly but the Enter event of the other one is being called...
1
by: theinvisibleGhost | last post by:
Is there an underlying interface anywhere that .NET form controls use to include the Enter, Leave, GotFocus, and LostFocus events? I have a problem where I've got a usercontrol which is being...
0
by: jamcompany via AccessMonster.com | last post by:
I have set up speed testing. I noticed that the majority of the time to load the login form (the form listed in my startup) is between the Form's Current event and the first control's Enter event....
2
by: ozarka | last post by:
I have a search form. and many unbound control. My main search text box "txtAccount" is acting weird or I am not doing it right. I want user to input a value and hit the enter key. I put...
1
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hello I've created a .NET 2.0 form and added 6 text boxes, 1 combo box and 2 button controls. The combo box has a DropDownStyle of DropDown, so the user can still type in the combo box. ...
0
by: Rainer Queck | last post by:
Hello NG, the hint on the property editor for the Form "Enter" event sais: Gets fired, if this control gets the active control. In my application I experience, that this is "mostly" true, but...
4
by: ronakinuk | last post by:
hello i need help in this please. i dont have much knowledge of VBA but can do very basic things by learning from different forums. i want to create one excel application where there will be few...
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: 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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.