Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Separate with a comma datagridview rows

DATAGRIDVIEW PIECTURE In my recent project I am currently developing a P.o.S system. The system is connected to a thermal printer that uses commands in order to process a fiscal receipt. The format of the command is : ecr.WriteCommand(48, "1,0000,1");. Which means ("price , quantity , vatNumber"). However since the size of products is not known i loop through my datagridview1.HOW CAN I SEPPARATE EACH DATAGRID VIEW COLUMN WITH A COMMA (,) AND CREATE A COMMAND LIKE THE COMMAND ABOVE.

some of my code:

try
{
    Ecr ecr = new Ecr("COM2", 9600);

    ecr.OpenPort();

    foreach (DataGridView row in dataGridView1.Rows)
    {
        if (row.Column.Count > 0)
        {
            for (int i = 1; i < row.Cells.Count; ++i)

 //print receipt item, vat - Б, quantity - 1.000, price - 10.00

ecr.WriteCommand(49,EcrTranslator.ConvertCp1251ToCyrillicByteArray("TEST ARTIKL\tB10.00*1.000"));
            }
        }
    }

    // Sample format ecr.WriteCommand(48, "1,0000,1");
    // ecr.WriteCommand(53, "\tP30.00");

    ecr.ClosePort();
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}

Comments