The behavior I'm trying to get; is that when a user enters a cell (either by clicking or tabbing), my code responds to that event, creates a new form, shows that new form and when the user is finished with that form, a value is returned and my code sets the cell's value to equal that return value.
My problem is that when I execute the line of code
'myCell.Value = "Anything"'
The value of that cell doesn't get set at all. It still appears as "".
I've tried this in a few different events now, and I'm guessing I just haven't found the right one. BeforeEnterEditMode/AfterEnterEditMode/AfterCellActivate. I've also tried using myCell.SetValue(strMyReturnValue, false) but that doesn't seem to work either.
Does anyone know what I'm doing wrong?
Hm... perhaps you don't see the new value because the edit window is covering the cell. Before you set the value, try calling grid.PerformAction(ExitEditMode) and seeif that helps. I would do ths in the AfterCellActivate.
Thanks for the response; but I'm still struggling with this. Here is what my code looks like; e is the UltraCell that is active in the grid and this code is executed by the AfterCellActivate event....
Dim sVal As String = frmBetween.GetDisplayValue e.Style = ColumnStyle.Edit ugCriteriaFields.PerformAction(UltraGridAction.ExitEditMode) e.Value = sVal End If
I've tried changing the style to edit (it is originally default when it hits that line) and performing the ExitEditMode, but it doesn't seem to make a difference. Using the VS debugger when I step over the line 'e.Value = sVal' it shows that sVal has a value of "1 and 9" and e.Value = "". After I execute that line, e.Value still = "".
If I check the 'e.Activation' value and it says it is set to 'AllowEdit {0}'
The grid is bound to an UltraDataSource that shouldn't be read-only. The user is able to edit all of the cells directly; it's just when I try setting the value in code that it seems to fail.