怎么样才能让 datagrid 里的数据强制更新到DATASET 中   ? 
ds = new DataSet();
oda.Fill(ds,"secufile");
this.dataGrid1.DataSource = ds.Tables["secufile"] ;
dataGrid1.SetDataBinding(ds,"secufile");
现在有这样的一个问题,就是要如果我在DATAgrid 中插入一行并填写数据,填写完成之后如果我不点击其它行,此时数据并没有更新到 DS中 , 如果我点击其它行或都是让datagrid1失去焦点, 则数据就会更新的DS中;这种问题如果处理?

解决方案 »

  1.   

    更新前加一句
    this.bandedGridView1.PostEditor();
    试一下
      

  2.   


    bandedGridView   这是什么对象 !
      

  3.   

    你可以扩展DataGrid,然后在其中写上入下的代码,需要更新的时候就调用
    public void AcceptChange()
    {
    if(this.DataSource == null) return;
    if(this.Visible == false) return; BindingManagerBase bm=this.BindingContext[this.DataSource,this.DataMember];
    if(bm.Position==-1)return;
    try
    {
    int row = this.CurrentCell.RowNumber;
    this.CurrentCell = new DataGridCell(row + 1,this.CurrentCell.ColumnNumber);
    this.CurrentCell = new DataGridCell(row,this.CurrentCell.ColumnNumber);
    }
             catch(Exception ex)
    {}
    }
      

  4.   

    谢谢   MyLf(不睡觉的鱼)  
    所有的人