IOMonitor(Form)初期化処理 ------------------------------------------- Private WithEvents dc As DIO_LC Private Delegate Sub MonitorInvoke(sender As Object, e As NetDataEventArgs)
Friend Sub New(dc As DIO_LC)
' この呼び出しはデザイナーで必要です。 InitializeComponent()
' InitializeComponent() 呼び出しの後で初期化を追加します。 Me.dc = dc DIOName.Text = Strings.Right("000" & Me.dc.Index, 3) & ":" & Me.dc.DIOName & vbCrLf & Me.dc.Place Me.Text = Me.dc.Index & ":" & Me.dc.DIOName End Sub -------------------------------------------
イベント部処理 複数のスレッドから呼び出される為、Invokeしています。。。 ------------------------------------------- Private Sub dc_RecievedData(sender As Object, e As NetDataEventArgs) Handles dc.RecievedData If System.Text.Encoding.GetEncoding("SHIFT-JIS").GetString(e.Data).Substring(0, 1) = "R" Then If Me.InvokeRequired Then Me.Invoke(New MonitorInvoke(AddressOf DIO_Disp), sender, e) Return End If DIO_Disp(sender, e) End If End Sub -------------------------------------------
ちょっと気づきました…
Private Delegate Sub MonitorInvoke(sender As Object, e As NetDataEventArgs)