We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing behaviour of Home and End keys

Thread ID:

Created:

Updated:

Platform:

Replies:

24894 Feb 14,2005 05:23 AM UTC Feb 14,2005 09:23 AM UTC Windows Forms 1
loading
Tags: GridControl
Sue Harris
Asked On February 14, 2005 05:23 AM UTC

Is there a simpler/better way of changing the behaviour of the Home/End keys when not editing to move the current cell rather than entering edit mode, other than overridding the KeyPressed event? Thanks, Sue

Administrator [Syncfusion]
Replied On February 14, 2005 09:23 AM UTC

There are no property settings that affect this. I think you could use the CurrentCellKeyDown event to handle this though.
private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.Home)
	{
		this.gridControl1.CurrentCell.EndEdit();
		this.gridControl1.CurrentCell.MoveTo(1, 1, GridSetCurrentCellOptions.ScrollInView);
		e.Handled = true;
	}
	else if(e.KeyCode == Keys.End)
	{
		this.gridControl1.CurrentCell.EndEdit();
		this.gridControl1.CurrentCell.MoveTo(this.gridControl1.RowCount,
                this.gridControl1.ColCount, GridSetCurrentCellOptions.ScrollInView);;
		e.Handled = true;
	}
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;