Solved

Checking for updates to any controls on Windows Forms?

Posted on 2014-10-08
2
100 Views
Last Modified: 2014-10-09
I have a routine in my Form_Closing() Event that checks each control on my form that could change in value. If the value changes then a boolean variable is set in the controls Leave() Event. This isn't working real. Is there a better way to check if any values were changed. For example, if I load some data into some TextBox controls and the user changes some of it, what is the best and easiest way to flag that?

Thanks!
0
Comment
Question by:BlakeMcKenna
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40370126
In order for Leave to work, you need to have recorded the original value somewhere. TextChanged is better suited for your task, because it won't be called if the value does not change. Just do not forget to reset your boolean variables after you load data from the source.

An alternative would be to record the original data from the source into the Tag property. That property is free for you to use as you want. When you want to check if there has been a change, simply compare Tag to Text.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40370646
Ah...the tag property! I forgot about that one. Ironically, I have used that before and it does come in handy!

Thanks James!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

864 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

20 Experts available now in Live!

Get 1:1 Help Now