Author Topic: Any difference between Datasubscriber2 generated with designer and user code?  (Read 872 times)

niloc887

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hello,

I have created an app that functions correctly with an EthernetIPforCLXComm & Datasubscriber2 generated by the designer.

I am able to subscribe to the tags dynamically and access the driver from the partial class of the MainForm.

I am trying to move away from the visual components into a console app or service and I can't get the datasubscriber2 that i create to fire the datachanged event.

I've copied the exact code the designer creates into mine and assigned it to my instance of the ds but still no luck.

My question is, I guess, is it possible to create the datasubscriber (and get it to work) programatically or will I need to just stick with the designed code?

Thanks

Colin

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5320
    • View Profile
    • AdvancedHMI
Visual Studio is essentially an automatic code writer to do the work for you. Whether it is designer code or code you manually write, it is the same.

There are pieces of required code that is easily overlooked when looking in the designer generated files, such as calls to BeginInit and EndInit

The Datasubscriber is a tool to for creating subscriptions with a driver without the need for the user to manually write the code. If you are not using the designer, it does not make sense to use a DataSubscriber because it takes more effort than just directly subscribing to the driver.