1
Answer

string problem

Ask a question
george

george

15y
2.1k
1
hi guys i m beginner in c# and i wand a help with strings!
i have search for help 3months ago but i start agen  the project now


i have design a micro controller project that sen in serial port some character strings that contains at the beginning three characters!

the characters is two dashhes ## with a number inside
e.g. #1#

the micro controller part working OK bun th c# software that read this data i have problem with the strings!

i recive data with the

private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{

//RxString = serialPort1.ReadExisting();
RxString = serialPort1.ReadLine();
this.Invoke(new EventHandler(DisplayText));
}


and display with

private void DisplayText(object sender, EventArgs e)
{

textBox1.AppendText(RxString);

}


this works but i wand when the string detect #1# to display the rest characters of string in first line and when detects #2# to display in second line!

string format example

#1#vdfkm fskjf jklfkgj #2#kfldjdfgbkdj #1#mlkfjgvfdjgdf...........

can someone help me on this

thanks and sorry for my bad english

Answers (1)