16
Support Questions / Re: how to test the communication between plc and pc
« on: February 09, 2020, 07:28:21 AM »
archie has this code inside the controls
is it possible to use it ? and how?
Code: [Select]
#Region "Error Display"
Private Sub DisplaySubscribeError(ByVal sender As Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs)
DisplayError(e.ErrorMessage)
End Sub
'********************************************************
'* Show an error via the text property for a short time
'********************************************************
Private WithEvents ErrorDisplayTime As System.Windows.Forms.Timer
Private Sub DisplayError(ByVal ErrorMessage As String)
If Not m_SuppressErrorDisplay Then
If ErrorDisplayTime Is Nothing Then
ErrorDisplayTime = New System.Windows.Forms.Timer
AddHandler ErrorDisplayTime.Tick, AddressOf ErrorDisplay_Tick
ErrorDisplayTime.Interval = 5000
End If
'* Save the text to return to
If Not ErrorDisplayTime.Enabled Then
OriginalText = Me.Text
End If
ErrorDisplayTime.Enabled = True
MyBase.Text = ErrorMessage
End If
End Sub
'**************************************************************************************
'* Return the text back to its original after displaying the error for a few seconds.
'**************************************************************************************
Private Sub ErrorDisplay_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ErrorDisplayTime.Tick
Text = OriginalText
If ErrorDisplayTime IsNot Nothing Then
ErrorDisplayTime.Enabled = False
ErrorDisplayTime.Dispose()
ErrorDisplayTime = Nothing
End If
End Sub
#End Region
is it possible to use it ? and how?