Author Topic: CLX Write giving Object reference not set to an instance...  (Read 2232 times)

MarkInColumbus

  • Newbie
  • *
  • Posts: 4
    • View Profile
CLX Write giving Object reference not set to an instance...
« on: March 07, 2016, 02:29:32 PM »
I'm sure that I'm overlooking something basic, but I've found it's better to ask for help than to keep beating my head against it.   ;D

I'm attempting to use the EthernetIPforCLXCom.Write method, but I keep getting an error about  "NullReferenceException was unhandled - Object reference not set to an instance of an object."

I've put an EthernetIPforCLXCom driver on my form, and it is working fine for reading data into a basic label and toggling bits in a PLC with a basic button.  But get the error when I try to write an Integer to the PLC with the following command:   
                  EthernetIPforCLXCom1.Write("Program:Device1.Command", 0)

The driver name is correct.  The program tag is correct (as near as I can tell),  Integer value seems to be okay. 
The command is being issued from a basic (.Net) button on the form that I've dropped the driver on.  So, I'm confused about what object is not getting set.

Any suggestions would be greatly appreciated!

Thanks in advance.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: CLX Write giving Object reference not set to an instance...
« Reply #1 on: March 07, 2016, 02:45:26 PM »
Try to add a BasicLabel, then set PLCAddressKeypad to your tag name. Run the application and click on the label to see if it lets you write using that method.

What version of AdvancedHMI are you using?

MarkInColumbus

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: CLX Write giving Object reference not set to an instance...
« Reply #2 on: March 07, 2016, 03:53:28 PM »
I'm using version BetaV399a.

I added the label.  It reads the value okay, but gives the same error when I try to write using the keypad.

Did I forget to initialize something?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: CLX Write giving Object reference not set to an instance...
« Reply #3 on: March 07, 2016, 04:29:09 PM »
I'll test  it out in a it.

Try version 3.99d to see if it has the same issue

MarkInColumbus

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: CLX Write giving Object reference not set to an instance...
« Reply #4 on: March 07, 2016, 04:42:35 PM »
Okay.  Thanks Archie!

MarkInColumbus

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: CLX Write giving Object reference not set to an instance...
« Reply #5 on: March 07, 2016, 05:44:34 PM »
Hello Archie,

I tried version 399d, and it seemed to work fine.

Then I went back and tried the original 399a project that I downloaded with the Adavanced HMI files, and it also seemed to work fine - although it took a couple of tries because I had other things in it that were pointing to another PLC program that wasn't loaded.  Interestingly enough, it broke in exactly the same way with those non-existent links installed.  Once I removed all of the other controls on the form, it started working fine.

So, it seems that I've messed something up somewhere.  I suspect there's a broken link that's causing my problem.

Let me look at this some more before you spend any more time on it.  I'll report back here soon.

Thanks for your suggestions!  At least it got me off of dead-center by giving me something to try.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: CLX Write giving Object reference not set to an instance...
« Reply #6 on: March 07, 2016, 07:14:08 PM »
Let me know if you find a pattern to it. I am interested to see if I can replicate to narrow it down to a bug in the driver.