Solved

Send "Tab" key in datagrid when press "Enter" Key.

Posted on 2003-11-21
5
847 Views
Last Modified: 2008-02-01
hello.
Many applications that display data in a grid interface allow the user to use the ENTER (RETURN) key to navigate from cell to cell.
I want when I press Enter key the next cell of DataGrid  be selected. for first time this is done with follow code but for second time the focus go to the last cell of datagrid.


protected override bool ProcessCmdKey(ref Message msg, Keys keydata)
{

if(keydata == Keys.Enter)
{
 SendKeys.Send("{Tab}");
 return false;
}
base.ProcessCmdKey(ref msg, keydata);

}
0
Comment
Question by:mystar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 75 total points
ID: 9802829
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 9805646
You should change your code a little bit:

protected override bool ProcessCmdKey(ref Message msg, Keys keydata)
{

if(keydata == Keys.Enter)
{
 SendKeys.Send("{Tab}");
 return true;
}
return base.ProcessCmdKey(ref msg, keydata);

}
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 11669856
My recommandation: points to emoreau (the comment from TheAvenger is very near to the code of link I did provide).
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question