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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        581 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X