Hi all, as always great work Archie (legend),
Good chance this is a noob issue (bit rusty) apologies in advance. PLC has UDT tag DateTime02 structure/WallClock (all good)
I have the below - WriteUDT (writes no probs.) / ReadUDT I get the following error
'System.IndexOutOfRangeException' on the ReadUDT line. Any help would be appreciated.
Cheers
' -------------------------
Public Class MainForm
'some default .net here
'
Private Sub btnReadDT_Click(sender As Object, e As EventArgs) Handles btnReadDT.Click
'*******************************************************************************
'* Read from UDT Tag in PLC
'* 29/06/2018
'*******************************************************************************
Dim MyUDT01 As DateTimeUDT
MyUDT01 = EthernetIPforCLXCom1.ReadUDT("DateTime02", GetType(DateTimeUDT))
'Dim ret As String = EthernetIPforCLXCom1.Read("DateTime02") <--- this works no probs
'MessageBox.Show(ret)
End Sub
Private Sub btnWriteDT_Click(sender As Object, e As EventArgs) Handles btnWriteDT.Click
'*******************************************************************************
'* Write to UDT Tag in PLC
'* 29/06/2018
'*******************************************************************************
Dim MyUDT02 As New DateTimeUDT
MyUDT02.Year = 1111
MyUDT02.Month = 2
MyUDT02.Day = 3
MyUDT02.Hour = 4
MyUDT02.Minute = 5
MyUDT02.Second = 6
MyUDT02.Microseconds = 789
Dim MyValue As Integer
MyValue = EthernetIPforCLXCom1.WriteUDT("DateTime02", MyUDT02)
End Sub
End Class
Public Class DateTimeUDT
'*******************************************************************************
'* Testing UDT in PLC
'* 29/06/2018
'*******************************************************************************
Public Year As Integer
Public Month As Integer
Public Day As Integer
Public Hour As Integer
Public Minute As Integer
Public Second As Integer
Public Microseconds As Integer
End Class