留個記錄:
物件_reader的 event - TagRead 不能直接引用lstl.Items.Add方法,須透過Delegate技巧
Delegate Sub ShowTagCode(ByVal msg As String)
Private Sub ShowTagCodeOnLst(ByVal msg As String)
lst.Items.Add(msg)
End Sub
Private Sub _reader_TagRead(ByVal tags() As GAORFID.Tag) Handles _reader.TagRead
Dim i As Integer
For i = 0 To tags.Length - 1
If lst.InvokeRequired Then
Dim d As New ShowTagCode(AddressOf ShowTagCodeOnLst)
Try
Me.Invoke(d, New Object() {tags(i).ID})
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
lst.Items.Add(tags(i).ID)
End If
Next
End Sub
沒有留言:
張貼留言