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 DannyP96, 05-18-2026, 02:38 PM
        1 response
        83 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        143 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        83 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        256 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        334 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X