Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Plz anyone can send me a sample program
i have an problem about serial port plz help. i have an device which send data like #23 14 35 now i want to get it as textbox1.text =23 textbox2.text=14 and textbox3.text=35
plz help how to do it. i am using visual studio 2010
Posted
Comments
DamithSL 16-Dec-14 8:54am    
update the question with your code
Member 11051929 16-Dec-14 9:56am    
Sir I am beginner . so I don't have any code . I had just made graphical layout by placing 3 textboxs , 1 button and 1 richtextbox on form . I am using visual studio 2010.
ZurdoDev 16-Dec-14 8:55am    
Where are you stuck?
TheRealSteveJudge 16-Dec-14 9:54am    
What about a regex?
([0-9]{2})
will return three groups. 23, 14 and 35

1 solution

Start by looking at the SerialPort class[^] and make sure you can successfully receive the whole message before you start "playing" with it to split it up - the split bit is trivial in comparison.
At worst, a simple string.Split will do it:
C#
string input = "#23 14 35";
string[] parts = input.Split("# ".ToArray());

So ignore that until you have the complex bit working properly - it's generally harder than you think when you get started.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900