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
155
Unhandled Exception when clicking Drop Down Arrow on DateTime Editor
posted

I'm debugging an issue for an old application. 

It uses an ultraGrid and has the following code to setup editorsettings:

            DefaultEditorOwnerSettings editorSettings = null;

            // Add an item for editing date.
            editorSettings = new DefaultEditorOwnerSettings( );
            editorSettings.DataType = typeof( DateTime );
            //editorSettings.MaskInput = "mm/dd/yyyy";
           
            //editorSettings.MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth;
            editor = new DateTimeEditor( new DefaultEditorOwner( editorSettings ) );
            editorsValueList.ValueListItems.Add( editor, "Date" ).Tag = editor;

 

In the UltraGrid InitializeRow event, there is the following code to set the editor to a Date Editor:

 

int index = editorsValueList.FindStringExact( fieldType );

EmbeddableEditorBase editor = null;
            if (index >= 0)
                editor = (EmbeddableEditorBase)editorsValueList.ValueListItems[ index ].Tag;

            e.Row.Cells[ "Value" ].Editor = editor;

This results with the following UI:

Everything looks fine, but when I click on the down arrow for the date editor, the application crashes.

Here is my stack trace:

6/11/2010 : Object reference not set to an instance of an object.
   at Infragistics.Win.UltraWinMaskedEdit.EditInfo.MinValueForMask(Object minValue, String mask)
   at Infragistics.Win.UltraWinMaskedEdit.EditInfo.CalculateTrueMinValue()
   at Infragistics.Win.MonthDropDown.DoDropDown(EmbeddableUIElementBase element)
   at Infragistics.Win.DateTimeEditor.DoDropDown()
   at Infragistics.Win.EmbeddableEditorBase.DropDown()
   at Infragistics.Win.DateTimeEditorDropDownButtonUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea,

UIElement& captureMouseForElement)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e)
   at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e)
   at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
   at Infragistics.Win.UltraControlBase.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   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)

Any thoughts as to why this is crashing?

 

 

  • 69832
    Offline posted

    ray023 said:
    Object reference not set to an instance of an object.
       at Infragistics.Win.UltraWinMaskedEdit.EditInfo.MinValueForMask(Object minValue, String mask)
       at Infragistics.Win.UltraWinMaskedEdit.EditInfo.CalculateTrueMinValue()

    GOing by the stack trace, I believe this is a bug that was fixed a while back, so you probably just need to get the latest service release.

  • 469350
    Offline posted

    Hi,

    It's really hard to tell much from the code snippets you posted here. There's no indication here about what editorsValueList is or how it related to the issue at hand.

    It's also quite puzzling why you would use an DefaultEditorSettings object just to set the DataType. Is the column you are using not already a DateTime type? If not, then what type is it?

    You appear to be jumping through some hoops here, presumably to work around some underlying problem, but I can't even guess what that problem might be or why you are taking the approach you are taking.

    Can you explain in more detail why you are doing all this?