问题是我在Datagridview中写了什么东西
第1行保存数据自动但当我单击Row2单元格时(1)然后出现问题
使用Microsoft Office Access 2007进行数据库制作
这里是我的完整代码
由于
Public Class Form2
Dim UpdatePending As Boolean = False
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database9DataSet.Data' table. You can move, or remove it, as needed.
Me.DataTableAdapter.Fill(Me.Database9DataSet.Data)
End Sub
Private Sub ExampleBindingSource_ListChanged(ByVal sender As Object, _
ByVal e As System.ComponentModel.ListChangedEventArgs) _
Handles DataBindingSource.ListChanged
' Whenever there is an update, note that a change is pending.
'
' ListChanged does not fire when moving within a row, so this will not
' mark updates until done with the row. (Here "done" could mean moving
' to another row or closing the form.)
If Me.Database9DataSet.HasChanges Then
Me.UpdatePending = True
End If
End Sub
Private Sub DataGridView1_RowValidated(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
Handles DataDataGridView.RowValidated
' The RowValidated event occurs after
' BindingSource_*Changed operations, which
' makes it a good place to update our source database.
' However, this event fires at a number
' of times when we don't have pending updates.
' That's why we need the UpdatePending indicator
' to tell us whether to do anything.
' If we have an update pending, copy it to the source database
If UpdatePending Then
Me.DataTableAdapter.Update(Me.Database9DataSet.Data)
Me.UpdatePending = False
End If
End Sub