How to Show Produtos in Ticket

0

I have the following code to print a ticket, but it marks me an error in the dataGridView1, the error is as follows (the name dataGridview1 does not exist in the current context) foreach (DataGridViewRow row in dataGridView1.Rows) marks it after I write the foreach

CreateTicket ticket = new CreateTicket ();

            ticket.TextoIzquierda(" ");
            ticket.TextoCentro("TICKET CIERRE DE CAJA");
            ticket.TextoIzquierda(" ");
            ticket.TextoExtremos("FECHA : " + txtFechaV.Text, "HORA : " + txtHora.Text);
            ticket.TextoIzquierda(" ");
            ticket.EncabezadoVenta();
            ticket.lineasGuio();
            foreach (DataGridViewRow fila in dataGridView1.Rows)
            {
                ticket.AgregaArticulo(fila.Cells[1].Value.ToString(), int.Parse(fila.Cells[0].Value.ToString()), decimal.Parse(fila.Cells[3].Value.ToString()));
            }
    
asked by pankesito56 26.05.2018 в 22:01
source

1 answer

0

Before showing the other form, you can have a method that loads the ticket information.

Form2 form2 = new Form2();  
form2.LoadTicketInformation(dataGridView1);
form2.Show();

The LoadTicketInformation method receives the dataGrid and you can do the foreach.

    
answered by 26.05.2018 в 22:32