Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Checking for updates to any controls on Windows Forms?

Posted on 2014-10-08
2
Medium Priority
?
106 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

664 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