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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

shift-space select row

Thread ID:





17332 Aug 5,2004 08:44 PM UTC Aug 5,2004 10:17 PM UTC WinForms 1
Tags: GridControl
Daniel Chait
Asked On August 5, 2004 08:44 PM UTC

Again trying to make the grid act like excel, i put the following code in grid_KeyDown: if ( e.KeyCode == Keys.Space && e.Modifiers == Keys.Shift ) { grid.EndEdit(); GridRangeInfoList rowSelections = new GridRangeInfoList(); foreach ( GridRangeInfo range in grid.Selections.Ranges ) { GridRangeInfo rows = GridRangeInfo.Cells(range.Top, 1, range.Bottom, grid.ColCount); rowSelections.Add(rows); } grid.Selections.Clear(); foreach ( GridRangeInfo range in rowSelections ) { grid.Selections.SelectRange(range, true); } e.Handled = true; } which kind of does what I want, but ends up typing a Space key anyway. Suggestions?

Administrator [Syncfusion]
Replied On August 5, 2004 10:17 PM UTC

I think you will have to derive the grid and override virtual methods to avoid processing the space. Here is a first try at this.
public class MyGridControl : GridControl
	protected override bool ProcessDialogKey(Keys key)
		if ( (key & Keys.KeyCode) == Keys.Space && Control.ModifierKeys == Keys.Shift )
			Selections.SelectRange(GridRangeInfo.Row(this.CurrentCell.RowIndex), true);
			return true;
			return base.ProcessDialogKey (key);
	protected override void OnCurrentCellMoved(GridCurrentCellMovedEventArgs e)
		if(this.CurrentCell.MoveFromRowIndex != this.CurrentCell.MoveToRowIndex)
			GridRangeInfo oldRange = GridRangeInfo.Row(this.CurrentCell.MoveFromRowIndex);
				Selections.SelectRange(GridRangeInfo.Row(this.CurrentCell.MoveToRowIndex), true);
		base.OnCurrentCellMoved (e);


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon