Data from datagridview going from one screen to another

Asked

Viewed 27 times

0

Good afternoon, I have some data that load a datagridview, this data comes from a query in the database in slq, and in that datagrid I have a column with a chekbox, I wanted to know how to do even when the user ticks in chekbox on the line and this line appears on another screen, it is possible to do this and if yes how can I do it?

follows image that loads datagrid with chekbox forget the error in the image has already been adjusted. inserir a descrição da imagem aqui

follows the code that loads the screen

 private void ListaGrid()
    {
        try
        {
            SqlCommand separacao = new SqlCommand("usp_SeparacaoPic", conexaoDADOADV(true));
            separacao.CommandType = CommandType.StoredProcedure;
            separacao.ExecuteNonQuery();

            SqlDataAdapter dados = new SqlDataAdapter(separacao);
            DataTable dtLista = new DataTable();
            dados.Fill(dtLista);

            dgw_separacaopic.DataSource = dtLista;

            dgw_separacaopic.Columns["CLIENTE"].ReadOnly = true;
            dgw_separacaopic.Columns["PRODUTO"].ReadOnly = true;
            dgw_separacaopic.Columns["LOTE"].ReadOnly = true;
            dgw_separacaopic.Columns["PEDIDO"].ReadOnly = true;
            dgw_separacaopic.Columns["LIBERACAO"].ReadOnly = true;
            dgw_separacaopic.Columns["ITEM"].ReadOnly = true;
            dgw_separacaopic.Columns["QTDA"].ReadOnly = true;
            dgw_separacaopic.Columns["ESTOQUE"].ReadOnly = true;
            dgw_separacaopic.Columns["OBS"].ReadOnly = true;

        }
        catch
        {
            MessageBox.Show("Não exstem dados digitados para a consulta, por favor verificar!!!");
            return;
        }
    }

 private void button1_Click(object sender, EventArgs e)
    {
        for (Int32 index = 0; index < dgw_separacaopic.Rows.Count; index++)
        {
            if (bool.Parse(dgw_separacaopic.Rows[index].Cells[0].FormattedValue.ToString()) == true)
            {
                MessageBox.Show("teste");
            }

        }
    }

Thanks in advance.

  • But this line will appear where? in another Datagrid? or filling textbox in another form? explain a little better

  • Sorry for the lack of information, I need the selected line to appear in another grid, and when selecting lock the edit chekbox not to move anymore. I was able to check the line if it is selected or not, I just need to take the information to another grid.

  • PHP so in this example it was not very clear what I do in the second form where I have the other datagrid, so I did not mention that the grids are in different Forms.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.