隨筆-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 閱讀(530) 評論(0)  編輯  收藏 所屬分類: .Net

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


          網站導航:
           
          主站蜘蛛池模板: 朝阳区| 抚州市| 红原县| 洪江市| 平阴县| 宁晋县| 贵定县| 辰溪县| 大庆市| 渝中区| 临城县| 湛江市| 普洱| 绥化市| 长岛县| 怀化市| 南木林县| 鄂托克前旗| 贵定县| 沙河市| 固原市| 岐山县| 商洛市| 花莲市| 乳山市| 梅河口市| 东台市| 土默特右旗| 巴林右旗| 岢岚县| 洛浦县| 常宁市| 嘉定区| 黄龙县| 郓城县| 白水县| 乐安县| 定日县| 巨鹿县| 永春县| 清徐县|