Solved

Checking for updates to any controls on Windows Forms?

Posted on 2014-10-08
2
98 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Gridview User Control event not firing 4 45
Visual Studio installation 5 38
Need help with a query. 10 43
.net VBA word safemode 1 24
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

16 Experts available now in Live!

Get 1:1 Help Now