How to identify the data in the form has been modified?

  • Thread starter Thread starter Justin
  • Start date Start date
J

Justin

I have a simple VB form with many controls. When user add/modify a
record....if the user click the form close button...system should show a
messagebox that "something is modified. Do you really want to close?"

Instead of writing code in each and every control on the form....is there
any betterway (may be at form-level) to identify that user has modified
"somewhere" in the form?

Thanks in advance

J Justin
 
You can make one sub that contain all of this code:

Private myDataCh as Boolean = False

Private Sub myDataChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged, _
TextBox2.TextChanged, CheckBox1.CheckedChanged
myDataCh = True
End Sub
 
Hello,
This is good solution but user could edit data, then decide to restore
original values ( manual ) and your script will tell him that there is a
change.
other solution is keeping all data in private variables and in a function on
the end just make comparison for each control.
and if there is change then ask user what to do

good luck

Galin Iliev
MCSD, MCAD.NET
 

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

Back
Top