Hi,
I am using the Subscribe on certain tags that a user can define via XML, which is then read in and the subscriptions made.
Private Sub QCompositeButtonPLCMessages_ItemActivated(sender As System.Object, e As Qios.DevSuite.Components.QCompositeEventArgs) Handles QCompositeButtonPLCMessages.ItemActivated
Try
Dim frmPLCMessages As New frmPLCMessages()
If frmPLCMessages.ShowDialog(Me) = DialogResult.OK Then
ApplicationPLCMessages = New PLCMessages().Load
SubscribePLCMessages()
End If
frmPLCMessages = Nothing
Catch ex As Exception
Log.ErrorMessage(ex.TargetSite.Name, ex.Message, "1410")
End Try
End Sub
Private Sub UnsubscribePLCMessages()
For Each i As Integer In SubscriptionIDs
PLC.UnSubscribe(i)
Next
SubscriptionIDs.Clear()
End Sub
Private Sub SubscribePLCMessages()
UnsubscribePLCMessages()
For Each pm As PLCMessage In ApplicationPLCMessages
If pm.Message.Length > 0 Then
SubscriptionIDs.Add(PLC.Subscribe(pm.Tag, 1, AddressOf SubscriptionCallback))
End If
Next
End Sub
Upon initial loading of the main form the method SubscribePLCMessages is ran and the subscription works.
If i open the form frmPLCMessages and then click OK to the form the SubscribePLCMessages is re-ran to ensure any changes made to the XML file take place. However, upon this second call to SubscribePLCMessages my program hangs on the line 'PLC.Subscribe(pm.Tag, 1, AddressOf SubscriptionCallback)'.
Any Ideas?
Thanks.