R
Richard
When I reference "this" in call to event, I get the following error:
An unhandled exception of type 'System.NullReferenceException'
occurred in csbasesockets.dll
Additional information: Object reference not set to an instance of an
object.
Here is a summary of my code:
public delegate void TCPConnectionEventHandler(TCPConnection sender);
public class TCPConnection
{
public TCPConnection(){}
public event TCPCOnnectionEventHandler OnConnected;
public void Connect()
{
//some code to connect here...
this.OnConnected(this); <-- Error received here
}
}
public class frmClient: System.Windows.Forms.Form
{
public frmClient()
{
m_client = new TCPConnection();
m_client.OnConnected+= new
TCPConnectionEventHandler(this.client_OnConnected);
m_client.Connect();
}
private void client_OnConnected(TCPIPConnection sender)
{
//do something here...
}
}
When I hover over "this" there is information but when I hover over
"OnConnected" I can see "OnConnected = <undefined value>".
Thanks in advance...
An unhandled exception of type 'System.NullReferenceException'
occurred in csbasesockets.dll
Additional information: Object reference not set to an instance of an
object.
Here is a summary of my code:
public delegate void TCPConnectionEventHandler(TCPConnection sender);
public class TCPConnection
{
public TCPConnection(){}
public event TCPCOnnectionEventHandler OnConnected;
public void Connect()
{
//some code to connect here...
this.OnConnected(this); <-- Error received here
}
}
public class frmClient: System.Windows.Forms.Form
{
public frmClient()
{
m_client = new TCPConnection();
m_client.OnConnected+= new
TCPConnectionEventHandler(this.client_OnConnected);
m_client.Connect();
}
private void client_OnConnected(TCPIPConnection sender)
{
//do something here...
}
}
When I hover over "this" there is information but when I hover over
"OnConnected" I can see "OnConnected = <undefined value>".
Thanks in advance...