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
690
UltraTextEditor throwing exception when CharacterCasing = Lower
posted

We're using an UltraTextEditor for data entry of email data.  If we leave the CharacterCasing as Normal, or change it to Upper, there is no problem.  When we ask the control to display its value in Lower, we have exceptions popping up when we select a parent object that has no data to display.

Our data model exposes the email address in a nested property.  The control is bound to bound to the endpoint in a hierarchy like this:  Company.Employee.Email

We expect that the Employee property might be returning Null.

I haven't been able to recreate the error with a simple example yet.  If/when I do, I will post sample code.

Is there something different about the branch of Infragistics code that handles the Lower (remember, Upper and Normal are okay)?

We are using NetAdvantage 8.3.20083.1009

Thanks,
John

 

Here are the pertinent exception details:

==================================================================================

System.NullReferenceException was unhandled
. Message="Object reference not set to an instance of an object."
. Source="Infragistics2.Win.UltraWinEditors.v8.3"
. StackTrace:
.     
.      at Infragistics.Win.UltraWinEditors.TextEditorControlBase.get_Text()
.      at Infragistics.Win.UltraWinEditors.TextEditorControlBase.get_Value()
.     
.
.      at Infragistics.Win.UltraWinEditors.TextEditorControlOwnerBase.GetValue(Object ownerContext)
.      at Infragistics.Win.EmbeddableEditorBase.GetDataFilterSourceValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext)
.      at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(ConversionDirection direction, Boolean& isValidConversion, EmbeddableEditorOwnerBase owner, Object ownerContext)
.      at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext)
.      at Infragistics.Win.EditorWithText.GetElementText(EmbeddableUIElementBase element, Boolean ignorePasswordChar)
.      at Infragistics.Win.EditorWithTextUIElement.PositionChildElements()
.      at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
.      at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
.      at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
.      at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
.      at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
.      at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
.      at Infragistics.Win.UltraWinEditors.TextEditorControlBase.OnPaint(PaintEventArgs e)
.     
.
.      at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
.      at System.Windows.Forms.Control.WmPaint(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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
.      at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
.      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
.      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
.      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
.      at System.Windows.Forms.Application.Run(Form mainForm)

 

 

  • 469350
    Suggested Answer
    Offline posted

    There should not be any difference internally between Upper and Lower case. This sounds like a bug to me. If you are able to duplicate this in a small sample project, you should Submit an incident to Infragistics Developer Support so they can check it out.

  • 690
    posted

    Click on "Move next" twice and you'll see the exception pop up...

     

    <Form1.cs>

     

    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Forms;

    namespace WindowsFormsApplication2
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();

                SetupControls();

                // ===================================================================================
               
                List<Data> x = new List<Data>() {
                    new Data("Cat"),
                    new Data("Rat"),
                    new Data(null),
                    null,
                    new Data(""),
                    new Data("Fat") };

                BindingSource dataBindingSource = new BindingSource();
                dataBindingSource.DataSource = x;

                bindingNavigator1.BindingSource = dataBindingSource;

                BindingSource dataBindingSource2 = new BindingSource();
                dataBindingSource2.DataSource = dataBindingSource;
                dataBindingSource2.DataMember = "Insides";
                ultraGrid1.DataSource = dataBindingSource2;
               
                ultraTextEditor1.CharacterCasing = CharacterCasing.Lower;
                ultraTextEditor1.DataBindings.Add("Text", dataBindingSource2, "Name");

                ultraGrid1.Select(); // give focus
            }
        }

        public class Data
        {
            public class Inside
            {
                private string _name;
                private Inside() { }
                public Inside(string x) { _name = x; }
                public string Name { get { return _name; } }
            }

            public List<Inside> _Insides = new List<Inside>();
            public List<Inside> Insides { get { return _Insides; } }

            private Data() { }
            public Data(string x) { if (x != null) { _Insides.Add(new Inside(x)); _Insides.Add(new Inside(x + " 2")); } }
        }








        public partial class Form1
        {
            private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor1 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
            private System.Windows.Forms.BindingNavigator bindingNavigator1 = new BindingNavigator();
            private System.Windows.Forms.ToolStripButton bindingNavigatorAddNewItem = new ToolStripButton();
            private System.Windows.Forms.ToolStripLabel bindingNavigatorCountItem = new ToolStripLabel();
            private System.Windows.Forms.ToolStripButton bindingNavigatorDeleteItem = new ToolStripButton();
            private System.Windows.Forms.ToolStripButton bindingNavigatorMoveFirstItem = new ToolStripButton();
            private System.Windows.Forms.ToolStripButton bindingNavigatorMovePreviousItem = new ToolStripButton();
            private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator = new ToolStripSeparator();
            private System.Windows.Forms.ToolStripTextBox bindingNavigatorPositionItem = new ToolStripTextBox();
            private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator1 = new ToolStripSeparator();
            private System.Windows.Forms.ToolStripButton bindingNavigatorMoveNextItem = new ToolStripButton();
            private System.Windows.Forms.ToolStripButton bindingNavigatorMoveLastItem = new ToolStripButton();
            private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator2 = new ToolStripSeparator();

            void SetupControls()
            {
                // this
                this.Size = new Size(400, 300);

                //
                // ultraTextEditor1
                //
                this.ultraTextEditor1.Location = new System.Drawing.Point(271, 39);
                this.ultraTextEditor1.Name = "ultraTextEditor1";
                this.ultraTextEditor1.Size = new System.Drawing.Size(100, 21);
                this.ultraTextEditor1.TabIndex = 1;
                this.ultraTextEditor1.Text = "ultratexteditor1";
                this.Controls.Add(ultraTextEditor1);

                SetupBindingNavigator();
                SetupGrid();
            }

            private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();

            private void SetupGrid()
            {
                //
                // ultraGrid1
                //
                this.ultraGrid1.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
                this.ultraGrid1.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
                this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
                this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
                this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Dotted;
                this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
                this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
                this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
                this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
                this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;
                this.ultraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
                this.ultraGrid1.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
                this.ultraGrid1.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
                this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
                this.ultraGrid1.Location = new System.Drawing.Point(13, 39);
                this.ultraGrid1.Name = "ultraGrid1";
                this.ultraGrid1.Size = new System.Drawing.Size(240, 187);
                this.ultraGrid1.TabIndex = 4;
                this.ultraGrid1.Text = "ultraGrid1";
                this.Controls.Add(ultraGrid1);
            }

            private void SetupBindingNavigator()
            {
                //
                // bindingNavigator1
                //
                this.bindingNavigator1.AddNewItem = this.bindingNavigatorAddNewItem;
                this.bindingNavigator1.CountItem = this.bindingNavigatorCountItem;
                this.bindingNavigator1.DeleteItem = this.bindingNavigatorDeleteItem;
                this.bindingNavigator1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.bindingNavigatorMoveFirstItem,
                this.bindingNavigatorMovePreviousItem,
                this.bindingNavigatorSeparator,
                this.bindingNavigatorPositionItem,
                this.bindingNavigatorCountItem,
                this.bindingNavigatorSeparator1,
                this.bindingNavigatorMoveNextItem,
                this.bindingNavigatorMoveLastItem,
                this.bindingNavigatorSeparator2,
                this.bindingNavigatorAddNewItem,
                this.bindingNavigatorDeleteItem});
                this.bindingNavigator1.Location = new System.Drawing.Point(0, 0);
                this.bindingNavigator1.MoveFirstItem = this.bindingNavigatorMoveFirstItem;
                this.bindingNavigator1.MoveLastItem = this.bindingNavigatorMoveLastItem;
                this.bindingNavigator1.MoveNextItem = this.bindingNavigatorMoveNextItem;
                this.bindingNavigator1.MovePreviousItem = this.bindingNavigatorMovePreviousItem;
                this.bindingNavigator1.Name = "bindingNavigator1";
                this.bindingNavigator1.PositionItem = this.bindingNavigatorPositionItem;
                this.bindingNavigator1.Size = new System.Drawing.Size(382, 25);
                this.bindingNavigator1.TabIndex = 3;
                this.bindingNavigator1.Text = "bindingNavigator1";
                this.Controls.Add(bindingNavigator1);
                //
                // bindingNavigatorAddNewItem
                //
                //this.bindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                ////this.bindingNavigatorAddNewItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorAddNewItem.Image")));
                this.bindingNavigatorAddNewItem.Name = "bindingNavigatorAddNewItem";
                this.bindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = true;
                this.bindingNavigatorAddNewItem.Size = new System.Drawing.Size(23, 22);
                this.bindingNavigatorAddNewItem.Text = "Add new";
                //
                // bindingNavigatorCountItem
                //
                this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
                this.bindingNavigatorCountItem.Size = new System.Drawing.Size(36, 22);
                this.bindingNavigatorCountItem.Text = "of {0}";
                this.bindingNavigatorCountItem.ToolTipText = "Total number of items";
                //
                // bindingNavigatorDeleteItem
                //
                //this.bindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                //this.bindingNavigatorDeleteItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorDeleteItem.Image")));
                this.bindingNavigatorDeleteItem.Name = "bindingNavigatorDeleteItem";
                this.bindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = true;
                this.bindingNavigatorDeleteItem.Size = new System.Drawing.Size(23, 22);
                this.bindingNavigatorDeleteItem.Text = "Delete";
                //
                // bindingNavigatorMoveFirstItem
                //
                //this.bindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                //this.bindingNavigatorMoveFirstItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveFirstItem.Image")));
                this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem";
                this.bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true;
                this.bindingNavigatorMoveFirstItem.Size = new System.Drawing.Size(23, 22);
                this.bindingNavigatorMoveFirstItem.Text = "Move first";
                //
                // bindingNavigatorMovePreviousItem
                //
                //this.bindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                //this.bindingNavigatorMovePreviousItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMovePreviousItem.Image")));
                this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem";
                this.bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true;
                this.bindingNavigatorMovePreviousItem.Size = new System.Drawing.Size(23, 22);
                this.bindingNavigatorMovePreviousItem.Text = "Move previous";
                //
                // bindingNavigatorSeparator
                //
                this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator";
                this.bindingNavigatorSeparator.Size = new System.Drawing.Size(6, 25);
                //
                // bindingNavigatorPositionItem
                //
                this.bindingNavigatorPositionItem.AccessibleName = "Position";
                this.bindingNavigatorPositionItem.AutoSize = false;
                this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem";
                this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 21);
                this.bindingNavigatorPositionItem.Text = "0";
                this.bindingNavigatorPositionItem.ToolTipText = "Current position";
                //
                // bindingNavigatorSeparator1
                //
                this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1";
                this.bindingNavigatorSeparator1.Size = new System.Drawing.Size(6, 25);
                //
                // bindingNavigatorMoveNextItem
                //
                //this.bindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                //this.bindingNavigatorMoveNextItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveNextItem.Image")));
                this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem";
                this.bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true;
                this.bindingNavigatorMoveNextItem.Size = new System.Drawing.Size(23, 22);
                this.bindingNavigatorMoveNextItem.Text = "Move next";
                //
                // bindingNavigatorMoveLastItem
                //
                //this.bindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                //this.bindingNavigatorMoveLastItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveLastItem.Image")));
                this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem";
                this.bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true;
                this.bindingNavigatorMoveLastItem.Size = new System.Drawing.Size(23, 22);
                this.bindingNavigatorMoveLastItem.Text = "Move last";
                //
                // bindingNavigatorSeparator2
                //
                this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2";
                this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 25);
            }
        }
    }