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.

MoveTo() method

Thread ID:

Created:

Updated:

Platform:

Replies:

2882 Feb 18,2003 01:25 PM Feb 19,2003 09:49 AM Windows Forms 6
loading
Tags: GridControl
Bruce Onder
Asked On February 18, 2003 01:25 PM

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

Administrator [Syncfusion]
Replied On February 18, 2003 04:46 PM

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);
}

Bruce Onder
Replied On February 18, 2003 10:31 PM

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?

Administrator [Syncfusion]
Replied On February 19, 2003 06:07 AM

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.

Bruce Onder
Replied On February 19, 2003 09:14 AM

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?

Bruce Onder
Replied On February 19, 2003 09:19 AM

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)?

Administrator [Syncfusion]
Replied On February 19, 2003 09:49 AM

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.

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.

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.

;