隨筆-193  評(píng)論-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 閱讀(526) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): .Net

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 潮州市| 密云县| 临洮县| 顺义区| 许昌县| 扎鲁特旗| 崇信县| 射阳县| 兴文县| 博客| 新巴尔虎左旗| 黄骅市| 博湖县| 湟中县| 资中县| 崇州市| 彭泽县| 扶余县| 铜川市| 信阳市| 西乌珠穆沁旗| 宝兴县| 桐柏县| 孝义市| 连平县| 霸州市| 花垣县| 盘锦市| 饶平县| 车险| 蓬莱市| 昂仁县| 台北市| 集贤县| 浦县| 华宁县| 吉木乃县| 安阳县| 白河县| 棋牌| 星座|