Hello,
i'm trying to enter in edit mode on a cell but it seems does not work even on a simple example as the one attached to this discussion.
i'm trying with this code.
//ultraGrid1.Rows[2].Activate(); ultraGrid1.ActiveCell = ultraGrid1.Rows[2].Cells[0]; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);
Any idea why?
thank you
Hi,
The problem is that you are trying to do this in Form_Load.
Entering edit mode on a cell requires the grid to show a child control over that cell and put it into edit mode, but the DotNet framework will not allow you to set focus during Form_Load.
There are a couple of ways you can get around this. The easiest thing to do is to move your code to the Form_Shown event. If you do this, you might need to use a flag to make sure you on;y do it the first time, depending on the form and whether it can be shown more than once.
Another option is to use Form_Load, but instead of calling PerformAction directly from within the event handler, you use BeginInvoke to call a method that does it. This creates a delay so the code won't execute until after the form is displayed.
Hi Mike,
You are right. Trying to set the focus on the grid during the load event wont work and so wont work the performaction too.
Thank you for the reply.