Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Aug 6, 1997



Application Security Testing: An Integral Part of DevOps

A Form-Level DataChanged Property

Ever wished you could use the Save parameter outside of a Validate event? Have you noticed that if a bound control is changed and you set DataChanged back to False, Save is still true on Validate? Solve both problems by adding a public function:
Public Function FormChanged(frm As Form)
        On Error Resume Next
        Dim i As Integer, dChanged As _
        FormChanged = False
        For i = 0 To frm.Controls.Count - 1
                'for controls with no DataChanged 
                dChanged = frm.Controls(i)_
                If Err <> 0 Then 
'almost certainly is
' OjectDoesntSupportThisPropertyOrMethod
                        Err = 0
                        If dChanged = True Then
                                FormChanged = True
                                Exit Function
                        End If
                End If
End Function
Use this function any time by simply writing If FormChanged(Me) Then, or however you wish, and you can use it in the Validate routine with Save = FormChanged(Me).
Matthew Brown
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date