Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 200849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:08:51+00:00 2026-05-11T17:08:51+00:00

I have an Infragistics UltraNumericEditor (version 5.3, quite old) control on a form. If

  • 0

I have an Infragistics UltraNumericEditor (version 5.3, quite old) control on a form.

If I set the .Value field to something less than .MinValue or something more than .MaxValue then I get a System.Exception thrown with the following message:

The ‘Value’ property cannot be set to a value that is outside the range determined by the ‘MinValue’ and ‘MaxValue’ properties

The signatures of the relevant fields on UltraNumericEditor are as follows:

public object MinValue { get; set; }
public object MaxValue { get; set; }    
public object Value { get; set; }

This has potential to occur many hundreds of times through our codebase, so rather than check MinValue and MaxValue vs the value we’re trying to set every time, I thought I’d subclass the control and put the check there:

public class OurNumericEditor : Infragistics.Win.UltraWinEditors.UltraNumericEditor  
{  
    public object Value  
    {
        get
        {
            return base.Value;
        }
        set
        {
            // make sure what we're setting isn't outside the min or max
            // if it is, set value to the min or max instead

            double min = (double)base.MinValue;
            double max = (double)base.MaxValue;
            double attempted = (double)value;

            if (attempted > max)
                base.Value = max;
            else if (attempted < min)
                base.Value = min;
            else
                base.Value = value;
        }
    }
}

Clearly this works fine when the type of value, MinValue and MaxValue can be casted to doubles, but I would expect an InvalidCastException when that’s not possible.

Now I may just be having a blonde moment here but I think it should be possible to write a method that makes use of generics to do the comparison, but I’m struggling to visualise what that might look like.

Any ideas or input at all?

Thanks
Tom

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:08:52+00:00Added an answer on May 11, 2026 at 5:08 pm

    You can’t make any good use of generics, as you don’t know the data type at compile time.

    Just use the Convert class to convert any kind numeric data to double values:

    double min = Convert.ToDouble(base.MinValue);
    double max = Convert.ToDouble(base.MaxValue);
    double attempted = Convert.ToDouble(value);
    

    This has the benefit that it also handles cases with mixed data types, like when MinValue is an int and value is a double.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an old software that written in VB6 with infragistics SSActiveToolBars control (ActiveThreedPlus).
I have been looking to set the office 2007 form style using infragistics, but
We're using Infragistics grid (most probably, we'll have 8.2 version at the end) and
I have UserControl that holds Infragistics Graph control. On the TreeView sub node's right
Hi We have to bind the data in web infragistics hiergrical control. so we
I have an UltraComboEditor (Infragistics control) and the user can input values on it.
I have a problem using Infragistics UltraTree control. I need a way to add
We have an ASP.NET application that uses the Infragistics WebSchedule control to display appointments
I have the following Infragistics WedDataGrid (version 2.9.2), and JavaScript function. The first column
I'm using the Infragistics UltraWebGrid control and have the following layout: <igtbl:UltraWebGrid ID=uwgPrescribedTrainingPlan runat=server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.