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
530
Intermittent unhandled exception when setting focus to checkbox formatted cell
posted

I receive an unhandled exception when setting focus to a checkbox formatted cell. How do I recode this so I don't receive an error? This error occurs randomly.

Here's my code:

grdBOL.Rows(0).Cells!Process.Activate()

grdBOL.Rows(0).Cells!Process.Selected = True

If grdBOL.Rows(0).Cells!Process.CanEnterEditMode Then grdBOL.PerformAction(UltraGridAction.EnterEditMode, False, False)

 

************** Exception Text **************
System.InvalidOperationException: Can't access SelectionStart unless the Editor is in edit mode.
   at Infragistics.Win.EmbeddableEditorBase.get_SelectionStart()
   at Infragistics.Win.EmbeddableTextBox.PositionControl(Rectangle bounds)
   at Infragistics.Win.EditorWithText.DisplayTextBox()
   at Infragistics.Win.EditorWithCombo.DisplayTextBox()
   at Infragistics.Win.EditorWithText.OnBeforeEnterEditMode(Boolean& cancel)
   at Infragistics.Win.EmbeddableEditorBase.EnterEditMode(EmbeddableUIElementBase embeddableElement)
   at Infragistics.Win.UltraWinGrid.UltraCombo.OnEnter(EventArgs e)
   at System.Windows.Forms.Control.NotifyEnter()
   at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
   at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
   at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
   at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control)
   at System.Windows.Forms.Control.WmSetFocus(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    Are you sure you are setting focus to the correct cell? The call stack here shows an error when entering edit mode on an UltraCombo, not a CheckBox. I can't tell if it's a standalone UltraCombo control on the form or a Combo embedded inside a grid cell, but I don't see anything here that indicates the involvement of a CheckBox in any way.

    This would make a lot of sense if grdBOL was actually an UltraCombo instead of an UltraWinGrid. Maybe you are just looking at the wrong control?