C# .NET - How to split data to text boxes when read qr code data ?

Asked By ahmed elbarbary on 19-Feb-17 05:13 PM
How to split data to text boxes when read qr code data ?

I work in windows form application c# visual studio 2015

This windows form read data by qr reader device and get it as this formate

30 General Conference of Arab Pharmaceutical Unions
 UserName : michel bondq
 Country : Egypt
 Membership : part

when read qr it give me message above in text file

I created text file  and open it by hand and read qr it give me message above

SO THAT

IF i need to read data from device and receive result directly from device in windows form application as following :

textbox1  michel bondq

textbox2 Egypt

textbox3 part

so that my question

if i need to read data directly to windows form how to receive and split data as following :

textbox1  michel bondq

textbox2 Egypt

textbox3 part

if i put cursor mouse in any textbox it read all data in only one textbox

i need to split it to textboxes after every (:) and  get value and put in textbox

please help me
Robbe Morris replied to ahmed elbarbary on 19-Feb-17 08:55 PM
You'll have to use .Split on the Environment.NewLine character in the whole string.  That will get you the lines.  Then you iterate through each line and to a .Split on ":" to get your data points.  You should be able to parse the arrays from there.

What I would to is put the cursor in the textbox.  When the event fires onchange, grab the text, then clear the textbox out and populate the rest of your form.  This will keep your UI from looking silly while you post the data to the form.