string - C# TextBox Control Not Updating With New Text -


i embedded system software developer safety critical systems, new c# proficient in c-based languages.

to provide little background, have developed windows form interprets serial data packets sent embedded software through serial port meaningful debugging information.

what want display each byte of each packet in textbox control. textbox control displays packet information second form opened first form. here's code event handler opens second form first:

private void showrawserialdata(object sender, eventargs e) {     sendserialdatatoform = true;     if (serialstreamdataform == null)         serialstreamdataform = new rawserialdataform();     serialstreamdataform.instance.show(); } 

in above code, .instance.show() directive means may open new form if form closed, not show new form if form open. then, in serial data received event handler, this:

// bytes serial stream bytestoread = ifdserialport.bytestoread; msgbytearray = new byte[bytestoread]; bytesread = ifdserialport.read(msgbytearray, 0, bytestoread); // msgbytearray has bytes read serial stream, // send raw serial form if (sendserialdatatoform == true && serialstreamdataform != null) {     serialstreamdataform.updateserialdatastream(msgbytearray); } 

where msgbytearray byte array of serial packet received. , here code updateserialdatastream:

public void updateserialdatastream(byte[] bytearray) {     string currentbytestring = null;     currentbytestring = bitconverter.tostring(bytearray);     currentbytestring = "0x" + currentbytestring.replace("-", " 0x") + " ";     if (rawserialstreamtextbox.invokerequired)     {         rawserialstreamtextbox.invoke(new serialtextboxdelegate(this.updateserialdatastream), new object[] { bytearray });     }     else     {         rawserialstreamtextbox.text += currentbytestring;     }     rawserialstreamtextbox.update(); } 

the end result value of rawserialstreamtextbox.text correctly updated string intend on adding text box! example, if pass byte array {0x01, 0x7f, 0x7e}, then, through debugger, can see value of rawserialstreamtextbox.text = "0x01 0x7f 0x7e".

the problem text box control not show newly added text. though can confirm through debugger rawserialstreamtextbox.text = "0x01 0x7f 0x7e" text box in windows not show "0x01 0x7f 0x7e" rather, remains blank.

any ideas might happening here?

i guess setting text property on instance other 1 being displayed. sanity check like

rawserialstreamtextbox.visible = false; 

does disappear?


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -