Retrieve data rom a list<>?

Hello everyone,
I have a web service which return List<>, and I want to retrieve those data.With Visual studio this code works:
`private void crecherche_frs_Load(object sender, EventArgs e)
{
DataGridViewColumn colcode = new DataGridViewColumn();
DataGridViewTextBoxCell celcode = new DataGridViewTextBoxCell();
colcode.CellTemplate = celcode;
colcode.HeaderText = "Code fournisseur";
dataGridView1.Columns.Add(colcode);

        DataGridViewColumn colnom = new DataGridViewColumn();
        DataGridViewTextBoxCell celnom = new DataGridViewTextBoxCell();
        colnom.CellTemplate = celnom;
        colnom.HeaderText = "Intitulé";
        dataGridView1.Columns.Add(colnom);

        DataGridViewColumn colresp = new DataGridViewColumn();
        DataGridViewTextBoxCell celresp = new DataGridViewTextBoxCell();
        colresp.CellTemplate = celresp;
        colresp.HeaderText = "Adresse";
        dataGridView1.Columns.Add(colresp);

        DataGridViewColumn colcat = new DataGridViewColumn();
        DataGridViewTextBoxCell celcat = new DataGridViewTextBoxCell();
        colcat.CellTemplate = celcat;
        colcat.HeaderText = "Responsable";
        dataGridView1.Columns.Add(colcat);



        {
        DAOfournisseur df = new DAOfournisseur();
        List<fournisseur> lst = new List<fournisseur>();
        lst = df.read_fournisseur();
        int k;
        int k2 = lst.Count;
        try
        {
            dataGridView1.Rows.Clear();

         for(k=0;k<=(k2-1);k++)
            {
                dataGridView1.Rows.Add();
                dataGridView1.Rows[k].Cells[0].Value = lst.ElementAt(k).Pcode;
                dataGridView1.Rows[k].Cells[1].Value = lst.ElementAt(k).Pintitule;
                dataGridView1.Rows[k].Cells[2].Value = lst.ElementAt(k).Padresse;
                dataGridView1.Rows[k].Cells[3].Value = lst.ElementAt(k).Presponsable;                    

            }


        }
        catch (MySqlException ex)
        {
            MessageBox.Show(ex.ToString());
        }

    }
    }





}`

but with xamarin .ElementAt(k).Pcode does not work.Would anyone help me.Thanks

Sign In or Register to comment.