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

      

  • 相关阅读:
    表达式for loop
    用户输入
    字符编码
    变量字符编码
    Python安装
    Python 2 or 3?
    Python解释器
    2017中国大学生程序设计竞赛
    Educational Round 27
    Round #429 (Div.2)
  • 原文地址:https://www.cnblogs.com/ROCKyou/p/4956785.html
Copyright © 2011-2022 走看看