Thanks Glen,
Here is what I have:
A serial dialog box contains a button that opens the serial port. The open port click event looks like the following:
private void buttonOpenPort_Click(object sender, System.EventArgs e)
{
try
{
if(PortOpen == false)
{
//OK, let's open it.
session = ResourceManager.GetLocalManager().Open(CurrentSession);
CurrentSerialSession = session as SerialSession;
if (CurrentSerialSession != null)
{
this.CurrentSerialSession.AnyCharacterReceived += new SerialSessionEventHandler(this.CharacterReceived);
//some other stuff
}
}
}
catch(problems)
}
The CurrentSerialSession is defined in
public class frmSerialDialog : System.Windows.Forms.Form
{
private Session session;
private SerialSession CurrentSerialSession;
private Session TempSession;
private SerialSession DisplayCurrentSerialSession;
private bool PortOpen;
// at the top of the class.
//on down I have:
private void CharacterReceived(Object sender, SerialSessionEventArgs e)
{
SerialSession ReceiveSerialSession = (SerialSession)sender;
int NumberOfBytes = ReceiveSerialSession.AvailableNumber;
textBoxReceive.Text = ReceiveSerialSession.ReadString(NumberOfBytes);
}
the CharacterReceived event is never firing even though I know that characters are coming in on the serial port. The question is,
where should the statement
this.CurrentSerialSession.AnyCharacterReceived += new SerialSessionEventHandler(this.CharacterReceived);
go?
Thanks
Barry