So I have a handler that contains the following code:
private static void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
SerialPort sp = (SerialPort)sender;
Form1 frm = //want to set 'frm' to the existing, instantiated form1 already running.
string indata = sp.ReadExisting(); //stores the char that fired the event into 'indata'
if (indata == "\r") //check to see if char received indicates end of measurement, yes tells main form to add measurement, no tells to add char to string
frm.pendingMeasurement = true;
myString += indata;
Form1 behave somewhat like a Singleton:
Add a static
Form1 member to
public static Form1 instance;
Set it in
instance = this;
And then access it in your code like this: