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