Hi first of all i have looked already but didnt seem to get help with this issue.
Basically my application fires an event on data received from a serial port using this:
sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
And i handle the data received using:
private static void sp_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
{
string inData;
bool passed;
SerialPort spRead = (SerialPort)sender;
inData = spRead.ReadLine();
TwinCat comm = new TwinCat();
passed = comm.passiButton(inData);
if (passed) comm.disposeComm();
else MessageBox.Show("Error Closing Comm");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
In additional to that i have a checkbox control and i would like to pass if checked or not i.e. an extra bool variable so that i can change what to do with the data depending if the checkbox is checked or not.
Note that the conditions are not implemented yet as i cannot pass the bool variable in the event.