Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2007, 02:05 AM
Authorized User
 
Join Date: Jan 2007
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Capturing a "Enter" key event in C# windows applic



I have created an aplication in C# windows application version 1.1 to display some records in a datagrid.
The datasource of the datagrid is datatable and not any database.I want tht when we edit any cell of a particular column
 and press "Enter" it should show a Message Box let's say "the cell is edited."
I wrote this but its not working

private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue.ToString()=="Enter")
            {
                // When the user presses both the 'Alt' key and 'F' key,
                // KeyPreview is set to False, and a message appears.
                // This message is only displayed when KeyPreview is set to True.
                this.KeyPreview = false;
                MessageBox.Show("KeyPreview is True, and this is from the FORM.");
            }
        }

Can anybody have any idea?

 
Old March 15th, 2007, 07:45 AM
Authorized User
 
Join Date: Oct 2004
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this


if (e.KeyValue.ToString() == "13")

GHari





Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter Key Event (Enter Key Only) Coby Excel VBA 0 February 6th, 2008 09:55 PM
enter key should execute button click event MunishBhatia ASP.NET 2.0 Professional 6 November 25th, 2007 10:59 PM
Enter Key event handler KevinO ASP.NET 1.0 and 1.1 Basics 2 August 17th, 2004 09:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.