"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