473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

using a 'dirty flag'

Hi,

I have heaps(50+) of text boxs on a form.

I want to have an dirtyflag type property that is set when any one of the 50
text boxes is change, so that i can prompt the user to save changes should
they exit.

Is there a easy way to do this against all 50 in one go, rather than have an
event to set the dirty flag against each text box ?

Thanks
Nov 20 '05 #1
3 5248
On 2003-11-29, AussieRules <so*****@nowhere.com> wrote:
Hi,

I have heaps(50+) of text boxs on a form.

I want to have an dirtyflag type property that is set when any one of the 50
text boxes is change, so that i can prompt the user to save changes should
they exit.

Is there a easy way to do this against all 50 in one go, rather than have an
event to set the dirty flag against each text box ?

Thanks


Set all of them to be handled by the same event...

Private Sub Changed(ByVal sender As Object, ByVal e As EventArgs) Handles _
TextBox1.TextChanged, _
TextBox2.TextChanged, _
TextBox3.TextChanged, _ ...

dirty = True
End Sub

Of course, you can also do it dynamically using AddHandler and
RemoveHandler...

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2
Create an event handler which handles all the changed events for all boxes.
This can set a class level object to define which ones are dirty.

PS: Aussie does not rule, we won the cup cobber, and dont u forget it !

OHM
AussieRules wrote:
Hi,

I have heaps(50+) of text boxs on a form.

I want to have an dirtyflag type property that is set when any one of
the 50 text boxes is change, so that i can prompt the user to save
changes should they exit.

Is there a easy way to do this against all 50 in one go, rather than
have an event to set the dirty flag against each text box ?

Thanks

Nov 20 '05 #3
* "AussieRules" <so*****@nowhere.com> scripsit:
I have heaps(50+) of text boxs on a form.

I want to have an dirtyflag type property that is set when any one of the 50
text boxes is change, so that i can prompt the user to save changes should
they exit.

Is there a easy way to do this against all 50 in one go, rather than have an
event to set the dirty flag against each text box ?


Set the 'CausesValidation' property of the controls and add a common
'Validating' event handler to the controls by using 'AddHandler' (see
MSDN).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

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

Similar topics

6
by: Sean C. | last post by:
Helpful folks, I am having a hard time figuring out how to reduce my percentage of dirty page steal activity. Below are statistics for three fairly normal days, with the bufferpool hit ratios...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
2
by: Salad | last post by:
A97. I have a command button to save and exit. I had the code If Me.Dirty Then Docmd.RunCommand acCmdSaveRecord ...more code endif I was getting an error because a value was not getting...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
4
by: Steve Le Monnier | last post by:
The ADO.NET DataSet is idea for application development, especially if you need disconnected data. DataReader objects are great in the connected environment but are forward only. What do you do...
5
by: Alain Filiatrault | last post by:
Hi, I need to implement a "form.dirty" feature on a VB .NET form not related to a database. I need to know if any of the items (Textboxes, combo, listboxes, ...) was changed. Is there a quick...
15
by: aussie rules | last post by:
Hi, I have some really, really large forms with dozens of text boxs. What I want to do is somehow know that the user has edited a text box, so that if they close the form, i can ask them if...
10
by: Michael Maes | last post by:
Hi, I have a BaseClass from which many Classes Derive. In short: the BaseClass provides the functionalities (Methods) and the Derived Classes extend it with Properties. One of the (Base)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.