Solved

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

Posted on 2004-08-31
6
265 Views
Last Modified: 2010-04-23
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!
0
Comment
Question by:jxharding
  • 3
  • 3
6 Comments
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 11939999
You mean yourdataset.haschanges  this return true or false ?
0
 

Author Comment

by:jxharding
ID: 11940090
hi rondal, thats the one ,thanks,
in which form event can i use it, it seems closing and closed events are too late
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11940121
Hi jxharding,

Why are they to late ?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11940142
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
0
 

Author Comment

by:jxharding
ID: 11940143
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.
0
 

Author Comment

by:jxharding
ID: 11940149
saved again!,brilliant, thanks!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now