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

      

  • 相关阅读:
    Spinal Tap Case
    Sorted Union
    Search and Replace
    Boo who
    Missing letters
    DNA Pairing
    Pig Latin
    Where art thou
    Roman Numeral Converter
    Redis高级客户端Lettuce详解
  • 原文地址:https://www.cnblogs.com/ROCKyou/p/4956785.html
Copyright © 2011-2022 走看看