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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      46 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      67 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      35 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      95 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      59 views
      0 likes
      Last Post PaulMohn  
      Working...
      X