TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Minh
NA
47
134.4k
Pointer direction when press enter key in datagridview c#
Jun 4 2010 10:38 PM
Hi friends ,
I am very urgent for my project but i am in trouble with datagridview , When I press enter key in a datagridviewcell , I find , it is default that pointer will move down to the next row but It is not what i want , I want to change pointer direction when press enter key . It means , Instead of moving the pointer down to the next row , it will be moved to the next cell at current row . I have tried with an override for event of keyup but the pointer was only moved to the next cell at current row after moving down to next row as default , furthermore , it is useful for the row that was not the row beside last row . I hope to have your answer soon . Thank you .
Here is my code :
protected
override
void
OnKeyUp(
KeyEventArgs
e)
{
int
currentRow = 0;
int
indexColumn = 0;
int
Index;
if
(e.KeyCode ==
Keys
.Enter)
if
(RowCount > 0)
{
Index =
this
.CurrentCell.RowIndex;
indexColumn =
this
.CurrentCell.ColumnIndex;
if
(Index < RowCount - 1)
currentRow = Index - 1;
else
currentRow = Index ;
if
(indexColumn <
this
.ColumnCount - 1)
indexColumn += 1;
if
(currentRow >= 0)
this
.CurrentCell =
this
.Rows[currentRow].Cells[indexColumn];
}
base
.OnKeyUp(e);
}
Reply
Answers (
2
)
How Do I: Setup a Control for a (String)
HTML Reader??