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

      

  • 相关阅读:
    Win7 安装
    线上java排查
    spring boot
    redisson
    Jcaptca 图片
    URL重写
    gradle导出依赖的jar包
    Redis tomcat
    flex 通过htmlservices链接moss的rest(rest 的get post方式)
    java语言MySQL批处理
  • 原文地址:https://www.cnblogs.com/ROCKyou/p/4956785.html
Copyright © 2011-2022 走看看