第一个问题,你可以先于DataGridTextBoxColumn提交编辑结果之前进行处理,比如给它一个缺省值,方法是在DataGridTextBoxColumn.TextBox的Leave事件中处理。第二个问题,你的代码中是不是有类似这样的一句:((DataView)((CurrencyManager)this.dataGrid1.BindingContext[this.dataGrid1.DataSource,this.dataGrid1.DataMember]).List).AllowNew=false;
如果是,这可能是一个bug,如果不将它设为false,就不会发生异常。错误信息是这样的吧:
System.IndexOutOfRangeException: 索引超出了数组界限。
   at System.Windows.Forms.DataGrid.Edit(String instantText)
   at System.Windows.Forms.DataGrid.Edit()
   at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
   at System.Windows.Forms.Control.NotifyEnter()
   at System.Windows.Forms.ContainerControl.UpdateFocusedControl()问题发生在DataGrid接受焦点时,你可以在第二次填充数据后面加上dataGrid1.Focus();,你会发现马上就发生了上述异常,另外,如果焦点一直没有离开DataGrid(比如你在DataGrid的KeyDown事件中填充新数据),就不会发生异常。还有,如果你在填充后将绑定源的Position设为大于0,也不会发生异常。我以前没有解决这个问题,谢谢你的方法。