473,383 Members | 1,725 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,383 software developers and data experts.

Anything Changed Flag

I am wondering if there is an event or control that would throw a flag
once any kind of textbox or control on the form had changed. Sort of
like with Word say, if you bring up a document, and don't do any
editing, it doesn't ask you to save. I am wanting that same effect
without having to set my own flag and goto every controls textchanged,
etc to set it myself.

thanks in advance

Nov 21 '05 #1
3 958

"Not Aaron" <aa**********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I am wondering if there is an event or control that would throw a flag
once any kind of textbox or control on the form had changed. Sort of
like with Word say, if you bring up a document, and don't do any
editing, it doesn't ask you to save. I am wanting that same effect
without having to set my own flag and goto every controls textchanged,
etc to set it myself.

thanks in advance


It's like a lot of thing in .NET: You'll have to do it yourself, but it's
ridiculously easy to do.

Private changed = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
For Each c As Control In Controls
If TypeOf c Is TextBox Then
AddHandler c.TextChanged, AddressOf ChangeListener
ElseIf TypeOf c Is RadioButton Then
AddHandler DirectCast(c, RadioButton).CheckedChanged, AddressOf
ChangeListener
'etc for the control types you use. . .
End If

Next

End Sub
Private Sub ChangeListener(ByVal sender As Object, ByVal e As
System.EventArgs)
changed = True
End Sub

David

Nov 21 '05 #2
Loop through the controls on the form. If the control is a textbox then add
a handler to the textchanged event

Dim ctl As Control
For Each ctl In Form.Controls
If TypeOf ctl Is TextBox then
AddHandler ct1, Address HandlerForAllTextBox_ChangedEvent
End If
Next

Hope this helps.

Chris
"Not Aaron" <aa**********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I am wondering if there is an event or control that would throw a flag
once any kind of textbox or control on the form had changed. Sort of
like with Word say, if you bring up a document, and don't do any
editing, it doesn't ask you to save. I am wanting that same effect
without having to set my own flag and goto every controls textchanged,
etc to set it myself.

thanks in advance

Nov 21 '05 #3
Thanks for the help, its what I was looking for. I ended up making a
function that passes in a control. Therefore, when I do the typeOf, I
check for a groupbox/panel/etc and then have it call itself to make
sure I cover all controls. Thanks again.

- Not Aaron...really

Nov 21 '05 #4

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Mario T. Lanza | last post by:
I am developing an ASP class that allows users to view/edit many records in a table directly via their browser. In order to reduce the number of SQL statements being executed against the database...
2
by: M Wells | last post by:
Hi All, I'm a relatively newbie to SQL Server 2000, having come from a MySQL background. I'm creating my first Trigger statement on a table, and I'd like to know how I go about performing an...
7
by: Hans | last post by:
Hi! Does anybody of you have a good algorithm to capture when a value in a textbox is changed? I'm using the keypress/keydown events but they seems to be a bit inconsistent (IE and Mozilla)....
1
by: shanesj | last post by:
I have a combo box that updates the filter proprerty of a dataview, which works fine but when the form tries to close I get a system.nulreferenceexception. this is the code in the...
0
by: Danny M | last post by:
When i change the value in the dropdownbox. The value changes. When i check the datatable the value has changed But when i want to save it to the database the record didnt got a changed flag...
0
by: polen.t2006 | last post by:
Hi, in the past it worked well to send from own program a simulated Key- press of the Cursor-up key Taste to another program, that in the other prgram the selection of an item in a listfield...
1
by: RP | last post by:
In my Form, I have 20 or 30 Text Boxes and Combo Boxes. I am using a tabbed interface. When the Form's Close button is clicked, I want to check whether user attempted an entry in any of the Text...
4
by: tomb | last post by:
I'm using VB.net 2003 and a FileSystemWatcher. The Changed event gets called twice for every change in the folder I'm watching. To build the functionality, I'm manually changing a text file. As...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.