0

My program consist of two classes: Form1 (windows form with textbox) and SerialCommunication (class for serial communication).
When data occurs on COM port DateRecievedHandeler store the message to indata.

public ref class SerialCommunication
{
private:
     static SerialPort^ mySerialPort;

public:
     static String^ indata;
     static void OpenPort();
     static void Close();
     static void DataReceivedHandler(Object^ sender, SerialDataReceivedEventArgs^ e);  
 };

In Form1 are included SerialCommunication.h and I have initialized object from SerialCommunication.

How to write method in class Form1 that will print indata to textbox from Form1 after DataRecievedHandler occurs.

Program is written in Visual C++ 2008 CLI aplication.

Edited by emil.rubinic: Gramathical error

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by emil.rubinic
0

String^ indata is declared as public so it will be accessible from Form1
as long as your SerialCommunication class is included in you Form1 class.

0

I know that, but I don't know how to write function that will read indata when DataReceivedHandler occurs
(DataReceivedHandler rewrite indata)

Edited by emil.rubinic

0

Other solution that I don't know how to make is that I somehow override method DataRecivedHandler (from SerialCommunication ) in class Form1 so that I can write to textbox from derivated DataRecivedHandler

Edited by emil.rubinic

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.