隨筆-193  評論-715  文章-1  trackbacks-0

          It seems, the DataGrid component is a depreted component.
          So I will try to use the DataGridView component.

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

          namespace  CATS
          {
              
          public  partial  class  QueryResumeForm : Form
              
          {

                  
          private  System.Data.DataTable dt  =   new  System.Data.DataTable();
                  DataGrid dataGrid 
          =   new  DataGrid();

                  
          public  QueryResumeForm(CATS.CatsAppForm parent)
                  
          {
                      InitializeComponent();
                      
          this .MdiParent  =  parent;
                      
          this .CreateTableStruct();
                  }



                  
          private   void  CreateTableStruct()
                  
          {
                      dt.Columns.Add(
          " textbox1 " , System.Type.GetType( " System.String " ));
                      dt.Columns.Add(
          " textbox2 " , System.Type.GetType( " System.String " ));
                      dt.Columns.Add(
          " textbox3 " , System.Type.GetType( " System.String " ));
                  }



                  
          private   void  queryButton_Click( object  sender, EventArgs e)
                  
          {
                      System.Data.DataRow dr 
          =  dt.NewRow();
                      dr[
          " textbox1 " =   " a " ;
                      dr[
          " textbox2 " =   " bb " ;
                      dr[
          " textbox3 " =   " ccc " ;

                      dt.Rows.Add(dr);

                      
          this .dataGrid.SetDataBinding(dt,  "" );
                      
          this .dataGrid.Parent  =   this ;

                      
          this .dataGrid.SetBounds( 10 50 500 300 );
                      
          this .dataGrid.Show();
                  }


              }

          }
          posted on 2009-01-03 22:40 Robin's Programming World 閱讀(525) 評論(0)  編輯  收藏 所屬分類: .Net

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 木里| 南雄市| 武隆县| 广德县| 房山区| 卢龙县| 周至县| 厦门市| SHOW| 丘北县| 华安县| 宁明县| 开原市| 南溪县| 建湖县| 沙坪坝区| 霍山县| 梁山县| 南雄市| 电白县| 建宁县| 卫辉市| 宜丰县| 石台县| 凤阳县| 太湖县| 鄂伦春自治旗| 宜良县| 芜湖县| 阿鲁科尔沁旗| 松溪县| 南涧| 象州县| 石首市| 中西区| 平南县| 兰西县| 孟津县| 广西| 凤城市| 肥城市|