How to Pass two Parameters to a delegate

  • Thread starter Thread starter Chad Dalton
  • Start date Start date
C

Chad Dalton

I need to be able to pass two parameters to a delegate. Can someone help
me out with the syntax? Here is my code. Thanks Chad...

Dim dlg As New DisplayDataDelegate(AddressOf DisplayReceivedData)
Dim args() As Object

args(0) = state.sMessage.ToString()
args(1) = state.TcpIndex
FrmMain.Invoke(dlg, args)
 
If I have understood your question right, then you can just do
dlg(state.sMessage.ToString(),state.TcpIndex)
to call the method through the delegate

Control.Invoke does the same thing but dispatches the method on the thread
that owns the control's windows handle.
 
Back
Top