Author Topic: VB.Net BasicButton PLCAddressClick NullReferenceException  (Read 1226 times)

anthony92

  • Newbie
  • *
  • Posts: 22
    • View Profile
VB.Net BasicButton PLCAddressClick NullReferenceException
« on: March 01, 2017, 07:14:56 PM »
When the BasicButton is clicked and the PLCAddressClick is not empty, and the PLC is defined but not available. The program will crash on the BasicButton.vb line 366 with exception.

Code: [Select]
An unhandled exception of type 'System.NullReferenceException' occurred in MfgControl.AdvancedHMI.Drivers.dll

Additional information: Object reference not set to an instance of an object.

I am using AdvancedHMI version 399s and the AdvancedHMIDrivers.EthernetIPforCLXCom class.

Should I disable the button from being clicked if it cannot connect to the PLC or is there something I can add to get rid of this error.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: VB.Net BasicButton PLCAddressClick NullReferenceException
« Reply #1 on: March 01, 2017, 11:21:02 PM »
If you go down to line 386, you can change it to this:

Catch ex as Exception

anthony92

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: VB.Net BasicButton PLCAddressClick NullReferenceException
« Reply #2 on: March 01, 2017, 11:56:13 PM »
Thanks! This works however ex.Errorcode has to be removed as it is not a member of Exception so I removed that too.