当前位置:网站首页>A series of problems of C DataGridView binding list

A series of problems of C DataGridView binding list

2022-04-23 21:25:00 Plant a sweet smell

problem 1. Binding data source is list after , The interface cannot be sorted ?

answer :dgvList.DataSource = _list; Can't sort ,

dgvList.DataSource = DataTable Yes. ;

problem 2. Binding data source is list after , The interface cannot move up and down ?

answer :dgvList.DataSource = _list; You can delete and add , Can't move up and down , because List The index determines ,

dgvList.DataSource = DataTable Yes. ;

problem 2. Binding data source is list after , Reassign list There will be out of index Error of ?

answer :list Reassign , First set the data source to null

dgvList.DataSource = null;

dgvList.DataSource = _list;

dgvList.DataSource = DataTable Yes. ;

版权声明
本文为[Plant a sweet smell]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/110/202204200619557124.html