I am confused. I tried what you said above and I cannot get that working.
//where plcAddress is the address of the register in string form
Me.Label1.Text = "Month: " & Alarms(0).month //i get the error Error 11 Operator '&' is not defined for types 'String' and '1-dimensional array of String'.
//page 2.vb
Public Class Page2
Structure Alarm
Public desc() As String
Public inCond() As String
Public active() As String
Public ack() As String
Public month() As String
Public day() As String
Public hour() As String
Public min() As String
Public sec() As String
End Structure
Dim Alarms(32) As Alarm
Dim plcAddress As String
'*******************************************************************************
'* Stop polling when the form is not visible in order to reduce communications
'*******************************************************************************
Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
If components IsNot Nothing Then
Dim drv As AdvancedHMIDrivers.IComComponent
'*****************************
'* Search for comm components
'*****************************
For i As Integer = 0 To components.Components.Count - 1
If components.Components(i).GetType.GetInterface("AdvancedHMIDrivers.IComComponent") IsNot Nothing Then
drv = components.Components.Item(i)
'* Stop/Start polling based on form visibility
drv.DisableSubscriptions = Not Me.Visible
End If
Next
For x As Integer = 0 To Alarms.Length
plcAddress = "ST31:" & x.ToString
Alarms(x).desc = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":0/0"
Alarms(x).inCond = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":0/1"
Alarms(x).active = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":0/3"
Alarms(x).ack = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":2"
Alarms(x).month = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":3"
Alarms(x).day = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":4"
Alarms(x).hour = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":5"
Alarms(x).min = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
plcAddress = "N1" & x.ToString("D2") & ":6"
Alarms(x).sec = EthernetIPforPLCSLCMicroCom1.Read(plcAddress, 1)
Next
End If
End Sub
Private Sub ReturnToMainButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MainForm.Show()
Me.Hide()
End Sub
Private Sub Page2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
After is tried that I thought about skipping the structure step and creating the array of addresses and just using the label to read them and display but this was what I got from that
Me.Label1.Text = "Month: " & Me.Read(plcAddress) //i get the error Error 11 'Read' is not a member of 'MfgControl.AdvancedHMI.Page2'.
//where Alarms(32) is a structure of strings and month is one of those
I guess I should be starting a new thread but...