开发者

How can I add array data in winform datagridview?

开发者 https://www.devze.com 2023-01-01 17:05 出处:网络
I generated Personel[] type array from Biz.Bal.GetPersonelById(\"1\") but if I want to add winforms, I do that like below. Is there a simpler method? Like GridView.dataSource=myArray?

I generated Personel[] type array from Biz.Bal.GetPersonelById("1") but if I want to add winforms, I do that like below. Is there a simpler method? Like GridView.dataSource=myArray?

  private void Form1_Load(object sender, EventArgs e)
        {
            Form_init();
            Model.Personel[] list = n开发者_StackOverflow社区ew Model.Personel[0];

            list = Biz.BAL.GetPersonelByID("1");
            dataGridView1.Rows[0].Cells[0].Value = list[0].ID;
            dataGridView1.Rows[0].Cells[1].Value = list[0].Ad;
            dataGridView1.Rows[0].Cells[2].Value = list[0].SoyAd;
            dataGridView1.Rows[0].Cells[3].Value = list[0].Maas;
            dataGridView1.Rows[0].Cells[4].Value = list[0].Departman;
}


Use databindings: Example here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号