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();
            }
        }
    }
    

      

  • 相关阅读:
    【Codeforces 475F】—Meta-universe(Set)
    【Codeforces 475F】—Meta-universe(Set)
    【UOJ #79】—一般图最大匹配(带花树)
    【UOJ #79】—一般图最大匹配(带花树)
    【NOIp2019模拟】题解
    【NOIp2019模拟】题解
    涉及到的业务逻辑总结
    2016-9-14
    Spring MVC
    2016-9-12
  • 原文地址:https://www.cnblogs.com/ROCKyou/p/4956785.html
Copyright © 2011-2022 走看看