Hai expert..................
please help me......
How to move to next cell in DataGridView by Pressing Enter
Thanks in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abdul Amin KhanPosted Sep 5, 2018, 12:06 AM
sushil kardhonePosted Apr 30, 2016, 3:31 AM
salman khanPosted Aug 10, 2012, 4:15 PM
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.ColumnCount - 1 == e.ColumnIndex) //if last column
{
KeyEventArgs forKeyDown = new KeyEventArgs(Keys.Enter);
notlastColumn = false;
dataGridView1_KeyDown(dataGridView1, forKeyDown);
}
else
{
SendKeys.Send("{up}");
SendKeys.Send("{right}");
}
}
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter && notlastColumn) //if not last column move to nex
{
SendKeys.Send("{up}");
SendKeys.Send("{right}");
}
else if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{home}");//go to first column
notlastColumn = true;
}
}
Soumya SurendranPosted Oct 2, 2009, 6:10 AM
Nagesh RPosted Oct 1, 2009, 6:29 AM
Soumya SurendranPosted Oct 1, 2009, 3:38 AM
Nir BarPosted Sep 30, 2009, 4:04 AM
You should create an event handler for the KeyUp event.
Pseudo-code should be:
Please mark this post as an answer if it helps you
Nir