Winform--使用BindingSource作为datagridview的数据源


如题。

使用方法简写:

private List<SaleProductInfo> saleProductList = new List<SaleProductInfo>();
private BindingSource bs = new BindingSource();

public FrmSaleManage()
{
      InitializeComponent();

      this.dgvProdutList.AutoGenerateColumns = false;
}

private void Funcation()
{
       //数据绑定
       this.bs.DataSource = this.saleProductList;
       this.dgvProdutList.DataSource = null;
       this.dgvProdutList.DataSource = this.bs;
}

BindingSource提供的方法:

this.bs.MoveLast();//dgv聚焦到最后一行

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM