PC Review


Reply
Thread Tools Rate Thread

Check for Changes

 
 
Michael Turner
Guest
Posts: n/a
 
      12th Jul 2004
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.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW5hbmRbTVZQXQ==?=
Guest
Posts: n/a
 
      12th Jul 2004
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.
>
>
>
>

 
Reply With Quote
 
Michael Turner
Guest
Posts: n/a
 
      12th Jul 2004
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]" <(E-Mail Removed)> wrote in message
news:42FE5408-B57E-43BE-81E9-(E-Mail Removed)...
> 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.
> >
> >
> >
> >

>




 
Reply With Quote
 
BluDog
Guest
Posts: n/a
 
      12th Jul 2004
>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.


Have a look at the TextChanged event.

Cheers

Blu
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      12th Jul 2004
* "Michael Turner" <(E-Mail Removed)> scripsit:
> 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.


Loop through the textboxes and add a handler to their 'ModifiedChanged'
event.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
=?Utf-8?B?QW5hbmRbTVZQXQ==?=
Guest
Posts: n/a
 
      12th Jul 2004
Write a single function that handles TextChanged Event for all textboxes. So that will run whenever any textbox is changed and focus is shifted to the next control.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Michael Turner" wrote:

> 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]" <(E-Mail Removed)> wrote in message
> news:42FE5408-B57E-43BE-81E9-(E-Mail Removed)...
> > 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.
> > >
> > >
> > >
> > >

> >

>
>
>
>

 
Reply With Quote
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      12th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:ukeir3$(E-Mail Removed)...
>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]" <(E-Mail Removed)> wrote in message
> news:42FE5408-B57E-43BE-81E9-(E-Mail Removed)...
>> 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.
>> >
>> >
>> >
>> >

>>

>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell check -- text marked skip spelling and grammar check =?Utf-8?B?RGF2aWQgQS4=?= Microsoft Word Document Management 8 9th Aug 2008 11:47 PM
Asp.net Treeview Clientscript - Auto Check Child Notes After Check Parent Node Sylvie Microsoft C# .NET 1 9th Oct 2007 02:25 PM
Treeview Clientscript - Auto Check Child Notes After Check Parent Node Sylvie Microsoft ASP .NET 1 9th Oct 2007 02:25 PM
In outlook get message "Spell check cannot check items...try agai =?Utf-8?B?am1yYW5jaG1hbg==?= Microsoft Outlook Discussion 1 28th Sep 2006 10:26 PM
Xp:Check Disk:Tools:Check Now:Both Options:reboot countdown does not complete? RAS Windows XP General 3 1st Feb 2005 06:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:47 PM.