How can I print each of the documents that a query brings me unless the ones that end in -1 C #

0

I have a problem printing all the documents that I bring to the GRID when they end in -1 example (collection789-1) you should not print that and jump to the one that follows.

private void button2_Click_1(object sender, EventArgs e)
    {
        r = new imprimirmanifiesto();
        int pos = 0;
        //bool a = true;
        for (int row = 0; row < dataGridView1.Rows.Count; row++)
        {
            r.imprimir(dataGridView1.Rows[pos].Cells[1].Value.ToString());
        }
    }
    
asked by Saul Salazar 02.08.2018 в 18:07
source

1 answer

0
private void button2_Click_1(object sender, EventArgs e)
{
    r = new imprimirmanifiesto();
    foreach (DataGridViewRow row in dataGridView1.Rows)
    {
        if (!String.IsNullOrEmpty(row.Cells[1].Value.ToString())
            && !row.Cells[1].Value.ToString().Contains("-1"))
            r.imprimir(row.Cells[1].Value.ToString());
    }
}
    
answered by 02.08.2018 / 23:53
source