zoukankan      html  css  js  c++  java
  • C#中DataGridView控件绑定数据源有几种方式?

    第一种:
    DataSet ds=new DataSet ();
    this.dataGridView1.DataSource=ds.Table[0];

    第二种:
    DataTable dt=new DataTable();
    this.dataGridView1.DataSource=dt;

    第三种:
    DataSet ds=new DataSet ();
    this.dataGridView1.DataSource = ds.Tables["表名"];

    第四种:
    DataSet ds=new DataSet ();
    this.dataGridView1.DataSource = ds;
    this.dataGridView1.DataMember = "表名";

    第五种:
    ArrayList Al = new ArrayList();
    this.dataGridView1.DataSource = Al;

    第六种:
    Dictionary<string, string> dic = new Dictionary<string, string>();
    this.dataGridView1.DataSource = dic;

    第七种:
    DataView dv = new DataView();
    this.dataGridView1.DataSource = dv;

    第八种:
    this.dataGridVi.DataSource = new BindingList<Object>(List<Object>);
  • 相关阅读:
    xml ui
    xml ui
    xml ui
    debug
    centOS7 mini配置linux服务器(一)安装centOs7
    数据结构之__链表
    数据结构之__队列
    数据结构之__栈
    在树莓派上使用 SSD1306 OLED 屏幕
    git官方手册
  • 原文地址:https://www.cnblogs.com/FLWL/p/4322290.html
Copyright © 2011-2022 走看看