刚才调试了一下
要实现你的效果不是不行,但真要做还是稍有点麻烦
要另建一个Table,显示在DataGrid上的Table在实现了你的想法后是不能用作更新的了
所以,你的另一个Table要同步,只是不AcceptChanges,这个用来更新数据库。
'在rowhead双击
Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.DoubleClick
Dim dt As DataTable = CType(Me.DataGrid1.DataSource, DataTable)
Dim mPos As BindingManagerBase
mPos = Me.BindingContext(dt)
If Me.DataGrid1.CurrentRowIndex <> -1 Then
Dim mc As DataRowCollection
mc = dt.Rows
Dim mRow As DataRow = dt.NewRow
mRow(0) = "9999"
mc.InsertAt(mRow, mPos.Position)
dt.AcceptChanges()
End If
End Sub