Generate 10000 matrix barcodes When generating a matrix barcode, it takes 1 minute per 10000 files .That's how to generating a matrix barcode for big quantities in less time.

Here is the library used to encoder data.

My code for button generating:

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

for (int i = 0; i &lt;= Convert.ToInt32(textBox1.Text); i++)
{
    Serial = SRL.Rnd().ToString();
    txt = "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" + Serial;

    dm.DM(txt, Color.FromName(comboBox1.SelectedItem.ToString()), Color.White).Save(root + "\\" + Serial + ".emf", System.Drawing.Imaging.ImageFormat.Emf);

}
MessageBox.Show("Records generated success ");


When creating 10000 in textbox1 it take 1 minute. If I write 200000 in textbox1 it takes 20 minutes.

The code is working without any problems and gives me results that I need, but it is slow. Can someone help me speed it up?
Strings are immutable so whenever you're concatenating them you're effectively creating new instances every time, this can slow down performance a lot, instead use StringBuilder and it's method Append() to build strings.
Avoid duplicate operations per each cycle unless it's necessary, such as Convert.ToInt32(textBox1.Text) convert the value to int before the for loop and save the value in variable, than later use the variable instead of converting the value every time. Another example is comboBox1.SelectedItem.ToString().