---
title: "generating 200000 datamatrix 2d barcode take too much time how to less time"  
description: "generating 200000 datamatrix 2d barcode take too much time how to less time"  
author: "Abeer Shlby"  
published: 2017-05-08  
updated: 2017-05-08  
canonical: https://www.mindstick.com/forum/34294/generating-200000-datamatrix-2d-barcode-take-too-much-time-how-to-less-time  
category: "c#"  
tags: ["c#", "ado.net", ".net", ".net framework"]  
reading_time: 1 minute  

---

# generating 200000 datamatrix 2d barcode take too much time how to less time

I make [windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) [form application](https://www.mindstick.com/interview/23108/how-to-create-form-application-using-dot-net) c# vs 2015 to generate 2d matrix barcodes for [pharmaceutical company](https://answers.mindstick.com/qa/37122/why-hasn-t-a-pharmaceutical-company-been-able-to-develop-a-pain-relieving-drug-that-isn-t-addictive) manufacture medicine .\
my problem when i make order to generate 2d matrix barcode for 200000 barcode and save barcodes in [hard disk](https://answers.mindstick.com/qa/102443/how-do-external-ssds-differ-from-traditional-hard-disk-drives) take 20 [minutes](https://www.mindstick.com/articles/23598/best-wedding-photographer-inspire-the-best-to-protect-your-valuable-minutes)\
How to minimize 20 minutes to 8 minutes when generate and saving 200000 barcode ?\
my code under [button as](https://answers.mindstick.com/qa/32548/do-you-ever-use-the-favorite-button-as-a-bookmark-on-twitter) following

I attached libarary for datamatrix [encoding](https://www.mindstick.com/interview/752/how-is-encoding-handled-in-ajax) with message

library [data matrix](https://www.mindstick.com/forum/34285/how-to-generate-data-matrix-2d-bar-code-for-c-sharp)\

```
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);        });
```

``

``

``


---

Original Source: https://www.mindstick.com/forum/34294/generating-200000-datamatrix-2d-barcode-take-too-much-time-how-to-less-time

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
