Help on database update

F

FST

Hello All,

Why does the database update from inside the Button1_Click event, but won't
update from inside the DataGrid1_CurrentCellChanged event when I change
cells? The message from inside the DataGrid1_CurrentCellChanged event
appears but OleDbDataAdapter1.Update(DataSet11) doesn't happen.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

OleDbDataAdapter1.Update(DataSet11)

MessageBox.Show("Database updated")

End Sub

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.CurrentCellChanged

MessageBox.Show("DataGrid1_CurrentCellChanged")

OleDbDataAdapter1.Update(DataSet11)

End Sub

Thanks,

Fred
 
S

Steven Stein [MSFT]

Fred,

When the CurrentCellChanged event fires the rowstate may not have changed
yet. You might try ending the current edit before firing the update method.


Steve Stein
VB Team
This posting is provided "AS IS", with no warranties, and confers no
rights.



--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top