473,489 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Check for Changes

Hi

I have a form with multiple text fields and need a way of checking to see if
changes are made in any of them I know I could use the keypress on each box
but there must be an easier way.

Thanks in advance.

Mike.

Nov 20 '05 #1
6 8814
Textbox.Modified?

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Michael Turner" wrote:
Hi

I have a form with multiple text fields and need a way of checking to see if
changes are made in any of them I know I could use the keypress on each box
but there must be an easier way.

Thanks in advance.

Mike.

Nov 20 '05 #2
>I have a form with multiple text fields and need a way of checking to see if
changes are made in any of them I know I could use the keypress on each box
but there must be an easier way.


Have a look at the TextChanged event.

Cheers

Blu
Nov 20 '05 #3
I see what you mean but I was hoping for a more global command that would
allow me to say if anything was modified on the form then it would run
rather than add code to each textbox.

Mike.

"Anand[MVP]" <An******@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com...
Textbox.Modified?

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Michael Turner" wrote:
Hi

I have a form with multiple text fields and need a way of checking to see if changes are made in any of them I know I could use the keypress on each box but there must be an easier way.

Thanks in advance.

Mike.


Nov 20 '05 #4
* "Michael Turner" <fi*****@m-turner.co.uk> scripsit:
I have a form with multiple text fields and need a way of checking to see if
changes are made in any of them I know I could use the keypress on each box
but there must be an easier way.


Loop through the textboxes and add a handler to their 'ModifiedChanged'
event.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
Write a single function that handles TextChanged Event for all textboxes. So that will run whenever any textbox is changed and focus is shifted to the next control.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Michael Turner" wrote:
I see what you mean but I was hoping for a more global command that would
allow me to say if anything was modified on the form then it would run
rather than add code to each textbox.

Mike.

"Anand[MVP]" <An******@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com...
Textbox.Modified?

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Michael Turner" wrote:
Hi

I have a form with multiple text fields and need a way of checking to see if changes are made in any of them I know I could use the keypress on each box but there must be an easier way.

Thanks in advance.

Mike.


Nov 20 '05 #6
Hi,

Here is how you can check all the controls on the form.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

CheckIfDirty(Me.Controls)

End Sub

Private Sub CheckIfDirty(ByVal ctrls As Control.ControlCollection)

For Each ctrl As Control In ctrls

If TypeOf ctrl Is TextBox Then

If DirectCast(ctrl, TextBox).Modified Then

Dim strOut As String

strOut = String.Format("{0} is dirty", DirectCast(ctrl, TextBox).Name)

Trace.WriteLine(strOut)

End If

End If

'

' check child controls if any

'

CheckIfDirty(ctrl.Controls)

Next

End Sub

Ken

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

"Michael Turner" <fi*****@m-turner.co.uk> wrote in message
news:uk**************@TK2MSFTNGP11.phx.gbl...
I see what you mean but I was hoping for a more global command that would
allow me to say if anything was modified on the form then it would run
rather than add code to each textbox.

Mike.

"Anand[MVP]" <An******@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com...
Textbox.Modified?

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Michael Turner" wrote:
> Hi
>
> I have a form with multiple text fields and need a way of checking to see if > changes are made in any of them I know I could use the keypress on each box > but there must be an easier way.
>
> Thanks in advance.
>
> Mike.
>
>
>
>


Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3177
by: SQLDBA | last post by:
What would be the best practice to follow to keep track of MS SQL server changes... Stroed procs, tables, views, triggers, indexes, DTS and also jobs ect.... I am not quite sure how Source safe...
5
8839
by: Lars Moastuen | last post by:
Hi! I'm currently playing around with a project where I need to know if an object (any object) has been altered since last check. I need this to know when an object needs to be saved... My idea...
6
2070
by: Frank Esser | last post by:
Hallo, I've got a project with about 10 pages. On each of them the user can do data changes (mostly datagrid interactions; the datagrids are bound to datasets). The user is able to jump to...
5
1812
by: needin4mation | last post by:
Hi, I have an asp.net 1.1 application that populates data from a database. When the user changes data, they have to hit a button to update the data. The data entry form (same form that is...
3
3865
by: | last post by:
Hello, I have a ListView control in Details view. When an item is un-checked, I want to change the ForeColor. The only way I have found to do this is to loop through all the items of the...
30
3349
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
1
1334
by: lauralaura | last post by:
Hallo ! is there in Java a clever method, which checks the changes in a database every 30 sec and after that it shows these changes? thanks alot.. Laura
5
5159
by: vovan | last post by:
I have set of controls (Textboxes, checkboxes etc) along with the Grid on Windows Form. I use BindingSource to populate both Grid and the set of Controls. User selects the record in the grid and...
2
6174
by: Ben | last post by:
Hi! All of a sudden on a newer version of our application a check box on the "Produce Invoice" form cannot be checked. I did not do any changes to this form at all. Below are the things that...
4
3481
by: jbrumbau | last post by:
Hello, I have a function that goes through each field in a form and checks if it was changed between itself and the existing recordset. It is used to track changes done in any record when the...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.