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
179
UltraNumericEditor gives FormatException when SpinIncrement set
posted

I'm having a problem with the ultraNumeric Editor with the following settings:

this.ultraNumericEditor1.AlwaysInEditMode = true;

this.ultraNumericEditor1.FormatProvider = new System.Globalization.CultureInfo("en-US");

this.ultraNumericEditor1.FormatString = "###.# MHz";

this.ultraNumericEditor1.Location = new System.Drawing.Point(124, 73);

this.ultraNumericEditor1.MaskClipMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.Raw;

this.ultraNumericEditor1.MaskInput = "nnn.n MHz";

this.ultraNumericEditor1.MaxValue = 600;

this.ultraNumericEditor1.MinValue = 0;

this.ultraNumericEditor1.Name = "ultraNumericEditor1";

this.ultraNumericEditor1.NumericType = Infragistics.Win.UltraWinEditors.NumericType.Double;

this.ultraNumericEditor1.PromptChar = ' ';

this.ultraNumericEditor1.Size = new System.Drawing.Size(100, 21);

this.ultraNumericEditor1.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always;

this.ultraNumericEditor1.SpinIncrement = 1;

this.ultraNumericEditor1.TabIndex = 0;

 This will throw a System.FormatException before the form displays complaining that the input string was not in a correct format.  If I remove the SpinIncrement settting then everything is fine.  What I would like to do is use the SpinIncrement to increment the number by some fractional amount, like 1.5.  Am I mis-interpreting the SpinIncrement here?  This only seems to appear when using the literals? in the MaskInput and FormatString.  The following code works fine:

this.ultraNumericEditor1.AlwaysInEditMode = true;

this.ultraNumericEditor1.FormatProvider = new System.Globalization.CultureInfo("en-US");

this.ultraNumericEditor1.FormatString = "###.#";

this.ultraNumericEditor1.Location = new System.Drawing.Point(124, 73);

this.ultraNumericEditor1.MaskClipMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.Raw;

this.ultraNumericEditor1.MaskInput = "nnn.n";

this.ultraNumericEditor1.MaxValue = 600;

this.ultraNumericEditor1.MinValue = 0;

this.ultraNumericEditor1.Name = "ultraNumericEditor1";

this.ultraNumericEditor1.NumericType = Infragistics.Win.UltraWinEditors.NumericType.Double;

this.ultraNumericEditor1.PromptChar = ' ';

this.ultraNumericEditor1.Size = new System.Drawing.Size(100, 21);

this.ultraNumericEditor1.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always;

this.ultraNumericEditor1.SpinIncrement = 1.5;

this.ultraNumericEditor1.TabIndex = 0;

Is there a way to get this to work the way I want?

 

Thanks

Parents
No Data
Reply
  • 6158
    Offline posted

    Using the code, you provided I was able to reproduce the FormatException. It appears that this may be a bug in calculating the maximum possible spin value when there are literals within the MaskInput.

    Unfortunately, there is no easy workaround for your issue. The only recommendation I can provide is to submit a support request to our Develoepr Support team, so that it can be looked at indepth, and you will get notified when a fix is available. To minimize turnaround time, make sure to indicate mention this forum post in the support request. In the meantime, I would suggest removing the line that set AlwaysInEditMode to true, and only have the literal on the FormatString.

    this.ultraNumericEditor1.AlwaysInEditMode = false;

    this.ultraNumericEditor1.FormatString = "###.# MHz";

    this.ultraNumericEditor1.MaskInput = "nnn.n";

    The control will not display the literal while it has focus, but they will be shown once focus is lost.  

     

Children