Bind Data in List to DatagridView

前端 未结 1 1273
孤街浪徒
孤街浪徒 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条回答
  • 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)
提交回复
热议问题