I make windows form application c# vs 2015 to generate 2d matrix barcodes for pharmaceutical company
manufacture medicine .
my problem when i make order to generate 2d matrix barcode for 200000 barcode and save barcodes in hard disk
take 20 minutes
How to minimize 20 minutes to 8 minutes when generate and saving 200000 barcode ?
my code under button as following

I attached serial and libarary for datamatrix encoding with message

 Class1 CLS = new Class1();
    DataTable dt = CLS.ShowalldataSerial(textBox4.Text);

     string baseText = "UserID" + dt.Rows[0][0] + "FirmName" + dt.Rows[0][1] + "OrderNo" + dt.Rows[0][2] + "BtachNo" + dt.Rows[0][3] + "Quantity" + dt.Rows[0][4] + "ProductName" + dt.Rows[0][5] + "SerialNo";
        Color foregroundColor = Color.FromName(comboBox1.SelectedItem.ToString());

        int serialsToGenerate = Convert.ToInt32(textBox1.Text);
        Parallel.For(0, serialsToGenerate, index=>
        {
            string Serial = SRL.Rnd().ToString();
            string txt = baseText + Serial;

            // WARNING HERE
            DM_Encoder dm = new DM_Encoder();
            dm.DM(txt, foregroundColor, Color.White).Save(root + "\\" + Serial + ".emf", System.Drawing.Imaging.ImageFormat.Emf);
        });

Recommended Answers

All 3 Replies

Watch out for strings outside the warning label. Replace strings by System.Text.StringBuilder.

I think youre first step should be to investigate other similar librairies. Just a quick glance at that one makes me question whether it's the most efficient.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.