Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to put a negative value in the Range attribute

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

    How to put a negative value in the Range attribute

    I am trying to put a negative number in a parameter but it keeps coming out zero. My Range looks like this:
    [Range(-5, 5)]
    [Display(Name="ExitTicks", Description="", Order=12, GroupName="Parameters")]
    public int ExitTicks

    I want to have a zero value where I can calculate 5 ticks above or 5 ticks below. So my range is -5 to +5. When I pass in -2 I get zero in my code. Is this possible to do? It seems like I have the syntax right.

    #2
    Hello cashinvestor,

    Thanks for your post.

    The syntax appears correct and when tested here I can get any value from -5 to +5, including 0.

    I would suggest debugging with a print statement to print to the output window the value of ExitTicks.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X