public class pro { StringBuilder PortData = new StringBuilder(); private void btnOpenPort_Click(object sender, EventArgs e) { mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); try { mySerialPort.Open(); txbShowFile.Text = PortData.ToString(); } } private static void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; PortData.Append(sp.ReadExisting()); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)