Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

range check

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

    range check

    hello, I have the following code in my properties section:

    [GridCategory("01. Test ")]
    [Gui.Design.DisplayNameAttribute("01. Test Value")]
    public int AutoRefreshHour
    {
    get { return testVal; }
    set { testVal= Math.Max(1, value); }
    }


    Is there a way I can check that the entered value is between 1 and 10 in this statement?

    thanks

    #2
    Hello FCatan,

    Thanks for your post.

    You can limit the input to be between 1 and 10 via:

    set { testVal= Math.Min (10, Math.Max(1, value)); }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    83 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    45 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    65 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X