以前一直做图形编程,对dataGrid了解特少,现在遇到点问题:在windows编程中如何dataGrid插入新行,但是可以编辑已有行呢?另外,我怎没判断ataGrid当前有多少行,MSDN中说ataGrid有Items属性,可在windows程序中却用不了。请各位老兄点拨了...

解决方案 »

  1.   

    see Windows Forms FAQ5.8 How do I prevent the datagrid from displaying its append row (the row at the end with an asterisk)?
    http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q653q
      

  2.   

    http://community.csdn.net/Expert/topic/3936/3936286.xml?temp=.1942102反过来做就可以了
      

  3.   

    ds.tables[0].defaultview.allowNew = false;
    ds.tables[0].defaultview.allowEdit= true;
      

  4.   

    当鼠标移到新行时datagrid 的 readonly设为false, 否则的话设为true
      

  5.   

    把 DataView 的AllowNew 设置为 false 就可以了
    ds.tables[0].defaultview.allowNew = false;