Link to home
Start Free TrialLog in
Avatar of jxharding
jxharding

asked on

how can i detect if changes have been made to my dataset

hi , i have a form with a datagrid, which is bound to a dataview, i want to write a procedure when the form_closing
event happens.
if there are any changes made to the dataset (the datagrid bound dataset /dataview)
then notify the user.
how can  i detect this, any sample links?
i did try the microsoft concurrency link
http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/03/04/DataConcurrency/TOC.asp
but it didnt help me, im on ms access
thanks!
ASKER CERTIFIED SOLUTION
Avatar of RonaldBiemans
RonaldBiemans

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jxharding
jxharding

ASKER

hi rondal, thats the one ,thanks,
in which form event can i use it, it seems closing and closed events are too late
Hi jxharding,

Why are they to late ?
maybe look at this code

Private Sub Form1_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
   ' Determine if text has changed in the textbox by comparing to original text.
   If textBox1.Text <> strMyOriginalText Then
      ' Display a MsgBox asking the user to save changes or abort.
      If MessageBox.Show("Do you want to save changes to your text?", "My Application", MessageBoxButtons.YesNo) = DialogResult.Yes Then
         ' Cancel the Closing event from closing the form.
         e.Cancel = True
      End If ' Call method to save file...
   End If
End Sub 'Form1_Closing
End Class 'Form1
the plan up to right now was  to execute this little piece of code,
  If Ds1.HasChanges = True Then
            MessageBox.Show("Update!")
            Exit Sub
 End If

and this would (supposed to have) allow the user to return to the form.
but now that you mention it, i prob should just put a dialogbox with a Yes and No button, asking the user if he wants to save.
saved again!,brilliant, thanks!