How use the barcode with C#

How use the barcode with C#


I'm not good in developpment and I need help for using the barcode and execute a barcode scan in C#.
I have not enough skills for understand and perform alone.

I would like to make a simple form where with one button I can perform a scan.

In this form I would like get data in a rich text box, and the type in a text box.

I tried to do something like that but it's not complete.
I need to know the correct syntax for:

- Get the type
- get the data
To put the data and the type in a tring I can display in a rich text box and a textbox.
If anybody can help it will be great:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Intel.Healthcare;
using Intel.Healthcare.Device;
using Intel.Healthcare.Exception;

namespace Uniform
public partial class Form1 : Form
public Form1()

private void button1_Click(object sender, EventArgs e)

//Create a BarcodeReader object.
BarcodeReader bcReader;
string a;

bcReader = new BarcodeReader();

Barcodes barcodeList = bcReader. // I think it's not good
bcReader.Barcodes.GetType(a); // I think it's not good again
bcReader.Barcodes.ToString(a); // I think it's not good again and I don't know what to write :(

textBox1.Text = a;


Thanks to read me.

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Have you looked at the Developers Guide for help in performing this function. The Guide is full of examples that you might find useful. The Guide is located at

This should get you going in the right direction.

John C

Hello Icarius,

the Barcode Scan Process delivers a list of barcodes.


After such a process you should do this:

barcodes = bcReader.Barcodes; // barcodes is the list/collection of barcodes
//Loop through each barcode in the collection
foreach (Barcode barcode in barcodes)
string[] barcodeStr = new string[2];
barcodeStr[0] = barcode.Type.ToString();
barcodeStr[1] = barcode.Value;
// Now you can put barcodeStr[0] into a textbox

This is mainly the example from IntelMCAExamplesCSharpBarcodeDemoNet.

I hope this helps


Excellent !!! It's working.

I adapt your proposal in ordert to use it, that's perfect.

I do have one more question. Then I try the same thing for Rfid I've got a problem :

foreach (RfidTag tag in objReader.RfidTags)

string[] rfidStr = new string[2];
rfidStr[0] = tag.Id.ToString();
rfidStr[1] = tag.Data.ToString(); ;
// On peut dsormais placer les donnes issues des codes barres dans des controles avec du texte.
label3.Text = ("ID");
label3.Visible = true;
label4.Visible = true;
textBox1.Text = rfidStr[0];
richTextBox1.Visible = true;
richTextBox1.Text = rfidStr[1];


And when it's running at the display I have "System.Byte[]" in the richTextBox1
Any ideas ?

I found !!!

It's necessary to encode the data in order to use in a string.

It's :

rfidStr[1] = encode.GetString(tag.Data).ToString();

instead of:

rfidStr[1] = tag.Data.ToString();

But I don't know why I can't display the textbox1 control


The follwing link will resolve your problem:-

Quoting - mimran

The follwing link will resolve your problem:-

I dont see how the link would resolve the problem at hand. Can you pleae elaborate more or give more guidance - sorry but I am very technial savy here.Thank you,clothes fashion korean wholesale fashion fashion wholesale fashion models garment. Movie film phim phim online viet entertainment phim han quoc drama clips

it is easy to add barcode functionality into your projects. refer to the barcode guide in C#.

Leave a Comment

Please sign in to add a comment. Not a member? Join today