I added the next ValueList to my grid, why this code doesn't return the new value of the cell?
vl.ValueListItems.Add( (byte) Shared.DocumentTypeEnum.Deposit, "This is a deposit" );
{
// If before CellChage fire, the cell is Deposit and the user change it to Cash,
// the user see in the grid "This is cash" but the underlying value
// is Deposit so it never enter the if. WHY?
... code goes here ...
This has nothing to do with the ValueList. The Value property of a cell returns the value from the underlying data source, so you can't use it for a cell that is currently being edited by the user.
This may not seem to make sense for a column with a dropdown list of values, but it's neccessary because sometimes when the user is in the middle of editing a cell in the grid the value is not valid as they are entering it. For example, suppose you have a cell in the grid that is storing dates. CellChange will fire each time the user types a key into that call. So if a user begins to enter a date and only types a single character, it is not a valid date, yet, and the Value property of the cell cannot possibly be updated at that point.
Anyway, what you can do is use the Text property of the cell to get the text the user has entered. To get the Value from the text, you can use cell.ValueListResolved.GetValue and pass in the text.
Another option might be to get the EditorResolved from the cell and examine the value of the editor.
Thank you very much Mike for your support, this explain very well the mistery and now I understand what actually is happening behind the scene. Thanks again.