Author Topic: Modbus TCP Comm -Transactions(e.TransactionNumber And 255) out of bounds  (Read 2314 times)

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
I am getting an error at:
Transactions(e.TransactionNumber And 255) "Index was outside the bounds of the array."
Code: [Select]
   If Transactions(e.TransactionNumber And 255) IsNot Nothing Then
            Transactions(e.TransactionNumber).ErrorReturned = True
        Else
            MsgBox(e.ErrorMessage)
        End If
in ModbusTcpipComm.vb

What does this mean? This is on a form with 1 ModbusTcpipComm object, 2 DataSubscribers, 12 AdvancedHMI Controls and a picturebox.

EDIT: Each pipe has a property set to "PLC" which is what I named the "ModbusTcpComm1"...  There are a lot of pipes, but less than 50. Are these interfering? I can't change the CommComponent for a pipe without it reverting automatically...

Any help would be much appreciated.

Quinton Wideman
« Last Edit: September 27, 2013, 05:10:03 PM by qwideman »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Modbus TCP Comm -Transactions(e.TransactionNumber And 255) out of bounds
« Reply #1 on: September 27, 2013, 05:08:47 PM »
Change the code to this:
Code: [Select]
        If Transactions(e.TransactionNumber And 255) IsNot Nothing Then
            Transactions(e.TransactionNumber And 255).ErrorReturned = True
        Else
            MsgBox(e.ErrorMessage)
        End If

qwideman

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Modbus TCP Comm -Transactions(e.TransactionNumber And 255) out of bounds
« Reply #2 on: September 27, 2013, 05:12:15 PM »
BINGO!

Thanks Archie!