Does anyone know how to get data from the grid cell?

1

Good evening guys, I have a history grid where the service is shown and I have two more grid below with the debits and pending debits I wanted to get from the clone of the grid above in which I mentioned first that it would be the client's . Clicking on the customer line to display the debids in the grids below the following message "method or action can not be implemented" and the program closes. Could someone help me?

 private void MontarListaDebitosCliente()
        {
            Int32 clienteid;
            string Mensagem;
            clienteid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
            Mensagem = bll.MontarListaDebitosClientes(clienteid);
            //Se ocorrer erro exibi-lo
            if (Mensagem != "") MessageBox.Show(Mensagem, "Erro encontrado:");
            //exibe na dataGridView os dados carregados na Classe/STP
            dataGridView2.DataSource = bll.DTPendentes;
            //    dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView2.ClearSelection();
        }
    
asked by anonymous 07.07.2016 / 04:24

2 answers

1

Hello,

when using

Cliente cliente = (Cliente)dataGridView1.SelectedRows[0].DataBoundItem;

You can directly direct the object that was selected. From there, just get the data from the other grids for that object.

I'm happy to help.

    
07.07.2016 / 07:21
1
clienteid = dataGridView1.SelectedRows[e.RowIndex].Cells[0].Value.toInt32();

maybe so

    
07.07.2016 / 17:44