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

Asked

Viewed 403 times

1

Good evening guys, I have a history grid where appears the service rendered and I have two more grid below with the paid debits and pending debits that I wanted to take from the top grid clinha in which I first mentioned that it would be the customer’s. Clicking on the client line to show the debits in the grids below appears the following message " method or action cannot be implemented " and the program closes. Someone could 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();
        }
  • 2

    Could you put some of the code in your question?

  • You are creating a link in one of the grid columns?

2 answers

1

Hello,

when using

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

you can directly get the object that was selected. From there, just fetch the data of the other grids by this object.

Smart to have helped.

1

clienteid = dataGridView1.SelectedRows[e.RowIndex].Cells[0].Value.toInt32();

perhaps so

Browser other questions tagged

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