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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        42 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        29 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        46 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X