Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Defining Min and Max values for user input.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Defining Min and Max values for user input.

    The help guide clearly shows how to define the min value; the max value and no min or max but, it does not show how to define a combination of min and max values:
    // No upper bound, lower bound of 1
    [Range(1, int.MaxValue)]
    // No lower bound, upper bound of 100
    [Range(int.MinValue, 100)]
    // No lower or upper bound
    [Range(int.MinValue, int.MaxValue)]

    For example, I want the user input field to have a minimum value of 1 and a maximum value of 3. The default value is 1. How do I change the code in the "Properties" section?

    #2
    Try [Range(1, 3)]. The two values are the lower bound and upper bound and can be any valid values for the input type, provided the lower bound is less than the upper bound.

    It's the Range Attribute in C#.

    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    Comment


      #3
      Jeronymite, You hit the nail on the head. That did the trick. It would have been helpful if the Ninja documentation included that scenario.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      573 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      575 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X