Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can someone explain this obj reference error

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

    Can someone explain this obj reference error

    I have posted some code in the EcoSystem - only to find out it later had an odd Obj Ref error. Doesn't stop the indicator working but nonetheless...
    Here is the offending code and after much nashing of teeth I discovered this little bit is the error but I do not understand why.

    Code:
        private void btn_Click(object sender, RoutedEventArgs rea)    
            {
            if(MouseClick)    // this is a bool
            MakeVisible();
         [COLOR=#c0392b] [B]  //else
            //return;[/B][/COLOR]
            }​
    In explanation I have allowed the user the option to either click the button or simple use OnMouseEnter ( ie no click).
    Why would return cause the error?
    Any explanations welcomed.

    #2
    Hello Mindset,

    I'm not able to reproduce.

    Attached is a simple test script.
    ButtonClickReturnTest_NT8.zip

    Are you certain the issue is not within the MakeVisible() method?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Well I suppose it could be but I can’t see it.

      here is a link to the entire code. With the error lines included.
      if I remove them the error disappears.

      Comment


        #4
        Hello Mindset,

        The script you have provided does not call return in the btn_Click handler method that I can see.

        I recommend you make a copy of the script. Then remove all other logic except for the specific code you are investigating.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        98 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        141 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
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        77 views
        0 likes
        Last Post PaulMohn  
        Working...
        X