===========================================
还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样
===========================================

解决方案 »

  1.   

    第一个问题我也不清楚。
    第二个问题:
    还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样用右键点击DataGrid,选择“自动生成属性”,然后增加一个模板列。之后用右键点击DataGrid,选择“编辑模板列”,在模板列中添加一个checkbox控件。
      

  2.   

    http://www.cnblogs.com/fellowcheng/articles/88550.html
      

  3.   

    DataGrid的数据源必须包含表的架构才能显示列标题。
      

  4.   

    你定义一个DataTable列值赋好.绑定就行了.
      

  5.   

    1、只要绑定的数据源不为null即可.
    试一下:
         DataTable table1 = new DataTable();
         this.Datagrid1.DataSource = table1;
         this.Datagrid1.DataBinding;
    2、这个需要你自己往里加。使用模板。
      

  6.   

    System.Windows.Forms.DataGridTableStyle myTableStyle = new DataGridTableStyle();
    myTableStyle.MappingName = myds.Tables[0].TableName.ToString();

    System.Windows.Forms.DataGridColumnStyle myColStyle = new  DataGridTextBoxColumn();
    myColStyle.MappingName = "Delegation";
    myColStyle.HeaderText = "代表类别";  
    myTableStyle.GridColumnStyles.Add( myColStyle ); myColStyle = new  DataGridTextBoxColumn();
    myColStyle.MappingName = "ShallArrive";
    myColStyle.HeaderText = "应到";
    myTableStyle.GridColumnStyles.Add( myColStyle ); myColStyle = new  DataGridTextBoxColumn();
    myColStyle.MappingName = "Arrived";
    myColStyle.HeaderText = "已到";
    myTableStyle.GridColumnStyles.Add( myColStyle ); this.dg_SignInResult.TableStyles.Add( myTableStyle );
      

  7.   

    ====================================================================
    用右键点击DataGrid,选择“自动生成属性”,然后增加一个模板列。之后用右键点击DataGrid,选择“编辑模板列”,在模板列中添加一个checkbox控件。
    ====================================================================
    我右击DataGrid既没有看到“自动生成属性”,也没有看到“编辑模板列”啊
      

  8.   

    第一个问题我已经解决了:当然,在tableStyles里面要设置好相应的MappingName 
    // 用一个空表作为各个DataGrid的数据源,使其有列表头和数据显示[1/13/2005]
    DataSet set1 = new DataSet();
    DataTable table1 = new DataTable("table1");
    for(int i=0;i<=20;i++)
    table1.Columns.Add(new DataColumn("Column"+i.ToString()));
    set1.Tables.Add(table1);
    this.dataGridApp.DataSource = set1;
    this.dataGridApp.DataMember = table1.TableName;
    this.dataGridOne.DataSource = set1;
    this.dataGridOne.DataMember = table1.TableName;
      

  9.   

    这个问题还是没有很好的解决,:
    ===============================
    还有,请问怎样才能在DataGrid每行前面加上CheckBoxes?就像listView中设置了CheckBoxes一样
    ===============================