By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,083 Members | 1,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,083 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"Justin" wrote:
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

Nov 21 '05 #2

P: n/a
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
"Alex Levi" <Al******@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
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

"Justin" wrote:
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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.