Accessing textboxes within a groupbox

I have a groupbox with two textboxes within it. I need to determine if they have been modified. How can I do this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

caddsmanAuthor Commented:
For clarification, how do I access the textboxes within the groupbox and determine if those textboxes have been modified?
Bob LearnedCommented:
If you know there only text boxes in the group box, you could loop through each text box in the group box controls:

      Dim ctl As TextBox
      Dim WasChanged As Boolean

      For Each ctl In Me.GroupBox1.Controls

         WasChanged = ctl.Modified

If you're trying to find out if any of the text boxes have been changed, then the only problem with above code is that WasChanged will take on the value of the last text box in the group.

Instead you might consider:

      Dim ctl As TextBox
      Dim WasChanged As Boolean = False

      For Each ctl In Me.GroupBox1.Controls
         If ctl.Modified then
            WasChanged = True
            Exit For
         End if

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Bob LearnedCommented:
That's what you get for 5 minutes of coding in the comment block without testing.
Well, we've all done that 1 or 2 (thousand) times ;-)
caddsmanAuthor Commented:
Oops, sorry frodoman. I meant to give yo the points. :(
Bob LearnedCommented:
You can always have a moderator fix this.  Ask in Community Support to have this question fixed.
Bob LearnedCommented:
You might also think about splitting the points.  If one person starts and idea, and another fixes any problems, then you can say that my comments was an 'Assisted' comment.

I'm all for splitting the points on this one.  TheLearnedOne rang in first with the basic code - I just fixed a simple logic error in the algorythm.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.