zoukankan      html  css  js  c++  java
  • datatable + gridveiw 便捷用法实例

    namespace WindowsFormsApplication9
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                dataGridView1.AutoGenerateColumns = false;
                //dataGridView1.DataSource = new FruitDA().Select();
                this.bindingSource1.DataSource = new FruitDA().Select();
                dataGridView1.DataSource = this.bindingSource1;
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                //MessageBox.Show( dataGridView1.SelectedCells[0].Value.ToString());
                MessageBox.Show(dataGridView1.SelectedColumns[0].HeaderText);
               // MessageBox.Show(dataGridView1.SelectedRows[0].Cells[0].ToString());
    
            }
        }
    }
    

      

    namespace WindowsFormsApplication9
    {
        public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
            }
    
            private void Form2_Load(object sender, EventArgs e)
            {
                dataGridView1.AutoGenerateColumns = false;
                dataGridView1.DataSource = new FruitDA().SelectDt();
            }
        }
    }
    

      

    namespace WindowsFormsApplication9
    {
        public partial class Form3 : Form
        {
            public Form3()
            {
                InitializeComponent();
            }
    
            private void Form3_Load(object sender, EventArgs e)
            {
                dataGridView1.DataSource = new Nation().getData();
            }
        }
    }
    

      

  • 相关阅读:
    为什么要用do-while(0)?
    网络字节序&大小端存储
    sql语句w3school教程
    C++编码规范
    std::deque双端队列介绍
    gdb基本操作
    gdb调试多线程
    数据库基础
    删除vector所有元素
    stl迭代器失效
  • 原文地址:https://www.cnblogs.com/ROCKyou/p/4956785.html
Copyright © 2011-2022 走看看