Author Topic: About a basicbutton  (Read 964 times)

UchihaKurt

  • Newbie
  • *
  • Posts: 11
    • View Profile
About a basicbutton
« on: July 12, 2015, 03:58:42 PM »
Hi guys, i want know if is possible in VB project a one button send information to 2 different plc with different IP?
thanks.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: About a basicbutton
« Reply #1 on: July 12, 2015, 04:29:26 PM »
Different IPs are already set through drivers that you add to the form.

If you are using the same driver to communicate to 2 or more different PLCs then just add more instances of that same driver to the form and set different IP addresses.

To have a single button click event communicate to multiple PLCs, you could set communication to one PLC through PLCAddressClick in the properties window of the button (using current CommComponent assigned to the button) and communication to the rest of PLCs through the button's Click event which you access by double-clicking the button in DesignMode.

Then just add code, similar to what Archie already explained in another post:

EthernetIPforCLXCom2.Write("MyStringTag","ABCDEF")
EthernetIPforCLXCom3.Write("MyStringTag","ABCDEF")

dmroeder

  • Global Moderator
  • Full Member
  • *****
  • Posts: 208
    • View Profile
Re: About a basicbutton
« Reply #2 on: July 12, 2015, 04:30:29 PM »
There is probably a round-about way you could accomplish this.  Add a basic button and driver, address the button to the first PLC.  Then you could add another driver.  Double click your basicbutton to get to the code view and the Click event.  Then you can write the code to write to your other PLC.  I haven't tried it but it seems like it would work:

Code: [Select]
   
Private Sub BasicButton1_Click(sender As Object, e As EventArgs) Handles BasicButton1.Click
        EthernetIPforCLXCom2.Write("Tag", 1)
End Sub

edit:  got side tracked while posting, I was slow.