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

MoveTo() method

Which event is best to trap for the following: I have a grid with two columns: one is a line number, the next is a product number. The user can enter either the line number or the product number, and my code will populate the rest of the row's cells. However, if the user enters a line number I want to control where the focus goes (in this case, I want to move from column 3, the line sequence number, to column 15, the quantity column). I found the MoveTo() method, but it always returns False when I try to call it. What's the best way to do this? --Bruce

6 Replies

AD Administrator Syncfusion Team February 18, 2003 09:46 PM UTC

You might try handling the CurrentCellMoved event, and if you are moving from column 3, then explicitly moveto column 15.
private void gridControl1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.IsInMoveTo && cc.MoveFromColIndex == 3)
		this.gridControl1.CurrentCell.MoveTo(cc.RowIndex, 8);
}


BO Bruce Onder February 19, 2003 03:31 AM UTC

Clay, For the new row, the IsInMoveTo property seems to be false, and the MoveFromColIndex property throws an exception in the watch window (although I can see that the protected/private moveFromColIndex member variable is 3). I can access these properties in CurrentCellMoving. Should I use this event?


AD Administrator Syncfusion Team February 19, 2003 11:07 AM UTC

I don't think CurrentCellMoving would be a good place for this as you would start another move before you completed the current move. I tried the suggestion in a GridControl before I posted it and it seemed to work there in the CurrentCellMoved event. It sounds like you might be using a GridDataBoundGrid. Attached is a sample that seems to work for that grid.


BO Bruce Onder February 19, 2003 02:14 PM UTC

Thanks for the sample. I'm comparing it against mine to see why I am getting different behavior. One thing I noticed is that some of the properties I see on your grid, such as Model.Options.WrapCell, are not available on my GridDataBoundGrid. My version of the Grid dll is 1.5.1.1. Can this be related to my issues?


BO Bruce Onder February 19, 2003 02:19 PM UTC

Duh, never mind. I only have one DLL on my machine, so it's obviously not a versioning issue. However, I am curious as to why some of these properties are not surfaced. Are some properties not exposed to VB.NET (that's what my app is written in)?


AD Administrator Syncfusion Team February 19, 2003 02:49 PM UTC

The wrapcell property is in the 1.5.1.6 release which is available from your support home page. If you are using an eval version, there will be a new eval posted in the next few days using the newer code base. In general, there are properties marked Advanced that will not appear in Intellisense with the VB editor. You can change this setting under Tools|Options|Text Editor|Basic in Visual Studio. There are only a very few (about 8 out thousands) of properties marked EditorBrowsableState.Advanced in teh Grid source code. WrapCell is not one of them. Attached is both a VB sample and a C# sample.

Loader.
Live Chat Icon For mobile
Up arrow icon