It would be useful if you could include in your documentation something about the order in which Grid Events occur.
I have one specific question/problem:
I''m using Grid beta 2. I want to know about a change to the value of a cell as soon as it happens, not when the user has moved to another cell. I''ve hooked up to the Grid CurrentCellChanged Event
In the handler for that event I examine the current value of the cell that has changed. (
eg with code like
However, the value returned is not the new value but the value but the value before a change was made. For instance, if I select a value from a drop down list, the change event is fired, but the value in the current cell is the previous item that was selected, not the current value.
Hope you can help with this
ADAdministrator Syncfusion Team March 15, 2004 10:09 AM
In CurrentCellChanged, you should get the current value from the cell renderer.ControlText. When a cell is actively being edited, the value is only known at the level of the cell control. It is not known at the grid level until you leave the cell.
Dim newValue As string = Me.Grid.CurrentCell.Renderer.ControlText
SJSamuel JackMarch 16, 2004 03:17 AM
What about if cells are changed by another means - programatically, or by pasting in values (which I guess is programatically). Would the CellsChanged event be raised in that case, rather than CurrentCellChanged? Were would I find these new values?
ADAdministrator Syncfusion Team March 16, 2004 04:15 AM
If you are typing into a cell, CellsChanging and CellsChanged are only fired when you leave the cell.
In CellChanging, you can get the cell that is changing from e.Range. You can get the new value from e.CellsInfo. If you are pasteing, the event is fired for every cell, so the new value will be e.CellsInfo.CellValue. But in some circumstances (maybe if you are programatically calling ChangeCells), then e.CellsInfo will have multiple values in it as will e.Range.
In CellChanged, the new value is already set into the grid, so you would get it there.