Hi,
Here is how you can check all the controls on the form.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
CheckIfDirty(Me.Controls)
End Sub
Private Sub CheckIfDirty(ByVal ctrls As Control.ControlCollection)
For Each ctrl As Control In ctrls
If TypeOf ctrl Is TextBox Then
If DirectCast(ctrl, TextBox).Modified Then
Dim strOut As String
strOut = String.Format("{0} is dirty", DirectCast(ctrl, TextBox).Name)
Trace.WriteLine(strOut)
End If
End If
'
' check child controls if any
'
CheckIfDirty(ctrl.Controls)
Next
End Sub
Ken
-----------------------
"Michael Turner" <fi*****@m-turner.co.uk> wrote in message
news:uk**************@TK2MSFTNGP11.phx.gbl...
I see what you mean but I was hoping for a more global command that would
allow me to say if anything was modified on the form then it would run
rather than add code to each textbox.
Mike.
"Anand[MVP]" <An******@discussions.microsoft.com> wrote in message
news:42**********************************@microsof t.com... Textbox.Modified?
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"Michael Turner" wrote:
> Hi
>
> I have a form with multiple text fields and need a way of checking to see if > changes are made in any of them I know I could use the keypress on each box > but there must be an easier way.
>
> Thanks in advance.
>
> Mike.
>
>
>
>