none
Dynamic SQL RRS feed

모든 응답

  • using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace 그리드
    {
     public partial class Form1 : Form
     {
      DataTable tbl = new DataTable("stu");
      public Form1()
      {
       InitializeComponent();
       
       DataColumn column;
       column = new DataColumn();
       column.DataType = Type.GetType("System.String");
       column.ColumnName = "이름";
       column.AllowDBNull = false;
       tbl.Columns.Add(column);

       column = new DataColumn();
       column.DataType = Type.GetType("System.String");
       column.ColumnName = "나이";
       column.AllowDBNull = false;
       tbl.Columns.Add(column);
       column = new DataColumn();

       column.DataType = Type.GetType("System.String");
       column.ColumnName = "출신도";
       column.AllowDBNull = false;
       tbl.Columns.Add(column);
       column = new DataColumn();

       column.DataType = Type.GetType("System.String");
       column.ColumnName = "출신고교";
       column.AllowDBNull = false;
       tbl.Columns.Add(column);

       dataGridView1.DataSource = tbl;

      }


      private void label2_Click(object sender, EventArgs e)
      {

      }

      private void textBox3_TextChanged(object sender, EventArgs e)
      {

      }

      private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
      {

      }

      private void button1_Click(object sender, EventArgs e)
      {

               
       DataRow row = tbl.NewRow();
       row["이름"] = textBox1.Text;
       row["나이"] = textBox2.Text;
       row["출신도"] = textBox3.Text;
       row["출신고교"] = textBox4.Text;
       tbl.Rows.Add(row);

      }

      private void button2_Click(object sender, EventArgs e)
      {
       DataView view = new DataView(this.tbl);
       view.RowFilter = textBox5.Text;
       dataGridView2.DataSource = view;
      }
     }
    }

    2009년 12월 8일 화요일 오후 9:47