Adding new line of data to TextBox

前端 未结 5 1345
一生所求
一生所求 2020-12-08 13:31

I\'m doing a chat client, and currently I have a button that will display data to a multi-line textbox when clicked. Is this the only way to add data to the multi-line textb

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 13:57

    C# - serialData is ReceivedEventHandler in TextBox.

    SerialPort sData = sender as SerialPort;
    string recvData = sData.ReadLine();
    
    serialData.Invoke(new Action(() => serialData.Text = String.Concat(recvData)));
    

    Now Visual Studio drops my lines. TextBox, of course, had all the correct options on.

    Serial:

    Serial.print(rnd);
    Serial.( '\n' );  //carriage return
    

提交回复
热议问题