Bind Data in List to DatagridView

前端 未结 1 1296
孤街浪徒
孤街浪徒 2021-01-20 18:38

I am trying to bind data to a datagridview in C#. How can I bind table data to a gridview please.

Below is my code used.

Getting all data.

pu         


        
1条回答
  •  不要未来只要你来
    2021-01-20 19:23

    You can do it using a Binding source:

         var source = new BindingSource();
         source.DataSource = new AddressAccess().getAllAddress().ToList();
         dgvAddresses.AutoGenerateColumns=true;
         dgvAddresses.DataSource = source;
    

    0 讨论(0)
提交回复
热议问题