Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2306
Can't get EnterEditMode to work!
posted

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

 

UltraGrid EnterEditMode cell.zip
Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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.

Children