Answer the question
In order to leave comments, you need to log in
C++ how to assign value to one variable while changing another?
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)
{
if(this->serialPort1->IsOpen){
try{
this->label2->Text=this->serialPort1->ReadLine();
}
Answer the question
In order to leave comments, you need to log in
You need to read the data as soon as it arrives. The above approach, to put it mildly, is not suitable. Which data variable do you want to assign? The port does not guarantee that everything sent "in one go" will also be received in one piece.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question