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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Entering values and hitting enter causes exception

Thread ID:

Created:

Updated:

Platform:

Replies:

8231 Oct 28,2003 08:07 PM UTC Oct 29,2003 05:12 PM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 28, 2003 08:07 PM UTC

Hi, I am using 1.6.1.8 Syncfusion databound grid on win2k/VS.NET 2003. I have my own cell model/renderer derived from text box cell model. When CurrentCellAcceptedChanges event occurs (when I enter a new value and hit enter) for that cell, I am changing lot of values in the grid cells. I am getting the following exception now. Can you help me out. thanks, - Reddy Exception stack trace: Do not move current position with this method! at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.SyncCurrentRecordState(Int32 pos) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnCurrentCellActivated(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellActivated() at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Activate(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options, Boolean discardChanges) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveTo(Int32 rowIndex, Int32 colIndex, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.InternalMove(GridDirectionType direction, Int32 num, GridSetCurrentCellOptions options) at Syncfusion.Windows.Forms.Grid.GridInternal.GridSelectCellsMouseController.GridCurrentCellExternalMove(GridDirectionType direction, Int32 num, Boolean extendSelection) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Move(GridDirectionType direction, Int32 num, Boolean extendSelection, Boolean wrapCell) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Move(GridDirectionType direction, Int32 num, Boolean extendSelection) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveRight(Int32 num, Boolean extendSelection) at Syncfusion.Windows.Forms.Grid.GridCurrentCell.MoveRight() at Syncfusion.Windows.Forms.Grid.GridControlBase.ProcessDialogKey(Keys key) at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData) at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData) at System.Windows.Forms.Control.PreProcessMessage(Message& msg) at System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG& msg) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Safertek.UFactory.Client.ClientStarter.Main(String[] args) in C:\dev\UFactory\UFactory.Client\Client\ClientStarter.cs:line 49

Administrator [Syncfusion]
Replied On October 28, 2003 08:31 PM UTC

That stack trace doesn't indicate that OnCurrentCellAcceptedChanges was hit so I am not sure if this helps. But, in general when you do some changes to the grid while within a current cell event, the CurrentCell.Lock() and CurrentCell.Unlock() calls often help. So, that would be the first thing to try to call CurrentCell.Lock() before you start changing cells and CurrentCell.Unlock() afterwards. Stefan

Administrator [Syncfusion]
Replied On October 28, 2003 08:59 PM UTC

Stefan, I wrapped my dataBoundGrid_CurrentCellAcceptedChanges() method between cc.Lock() and cc.Unlock(). No luck. It still gives me the same exception. Otherthing is, when I am tabbing through the cells in a row, grid fires CurrentCellChanged() event even though I really did not change anything. Is there another event that will get fired only when I modify the actual cell value e.g. updating price from 1.0 to 2.0. thanks, - Reddy

Administrator [Syncfusion]
Replied On October 29, 2003 01:53 PM UTC

Is dataBoundGrid_CurrentCellAcceptedChanges being hit before the exception? (Just making sure ...) Another idea: What if you call Binder.DirectSaveCellInfo = true; before making changes and binder.DirectSaveCellInfo = false; When you set a breakpoint in your handler of CurrentCellChanged, you could check out the call stack and identify the method in your renderer that caused the call to CurrentCellChanged. CurrentCellChanged should only get raised when the user edits the cell. Stefan

Administrator [Syncfusion]
Replied On October 29, 2003 05:01 PM UTC

Setting DirectSaveCellInfo =true/false is working. I am no longer getting that exception. I am sorry about the CurrentCellChanged event. It is CurrentCellAcceptedChanges that is getting invoked everytime I move from cell to cell. I want to do some calculations only when the user changes a value and leaves the cell. Currently I am using CurrentCellAcceptedChanges event. Everytime the user moves from cell to cell, my code is recalculating. Is there any other event I can listen on that will tell me that some changes are made to the cell and the user is about to leave the cell? thanks, - Reddy

Administrator [Syncfusion]
Replied On October 29, 2003 05:12 PM UTC

You can try CurrentCellValidating. To get the new value, use grid.CurrentCell.Renderer.ControlText.

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

;