I have a listbox on form SerialRx, which I am trying to populate with received serial data.
When I Rx serail data, I call a delegate callback called "CallBackSerial" in class "IVComObjects"
From that I am trying to call a sub on Form "SerialRx" to add to the listbox.
The Sub is called correctly with no errors but the data is not added to the listbox.
Any suggestions
When I Rx serail data, I call a delegate callback called "CallBackSerial" in class "IVComObjects"
From that I am trying to call a sub on Form "SerialRx" to add to the listbox.
The Sub is called correctly with no errors but the data is not added to the listbox.
Any suggestions
VB.NET:
'**********************8
'This is in DLL class IVComObjects
Public Delegate Sub SerialCallback(ByVal sUserPram As String, ByVal mPort As Int16, ByVal mData As String, ByVal nSize As Int16)
Public Sub CallBackSerial(ByVal sUserPram As String, ByVal mPort As Int16, ByVal mData As String, ByVal nSize As Int16)
Dim mstring As String
mData = Microsoft.VisualBasic.Left(mData, nSize)
mstring = sUserPram & vbCrLf & _
"Com Port " & mPort & vbCrLf & _
"Data Rx " & mData & vbCrLf & _
"Characters Rx " & nSize
SerialRx.DelegateTest(AddressOf SerialRx.AddToList, mData)
End Sub
'**********************8
'This is in form class SerialRx
Public Class SerialRx
Public Delegate Sub AddRxSerial(ByVal mData As String)
Sub DelegateTest( _
ByVal op As AddRxSerial, _
ByVal y As String _
)
op.Invoke(y) ' Call the method.
End Sub
Public Sub AddToList(ByVal strData As String)
' lstSerialRx.SuspendLayout()
lstSerialRx.Items.Add(strData)
' lstSerialRx.Update()
' lstSerialRx.Refresh()
' lstSerialRx.ResumeLayout()
End Sub
End Class