Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-11-21
5
Medium Priority
?
867 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 300 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

598 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