Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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

What I have tried:

How to split data to text boxes when read qr code data ?
Posted
Updated 19-Feb-17 10:11am

1 solution

Read the file as an array of lines: File.ReadAllLines will do that for you from a file, or you can process the QR data directly if that is possible with your hardware.
Then for each line, just use string.Split to break it:
string thisLine = "UserName : michel bondq";
string[] parts = thisLine.Split(':');
if (parts.Length > 1)
   {
   textBox1.Text = parts[1];
   }
 
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