Accessing textboxes within a groupbox

Hello,
I have a groupbox with two textboxes within it. I need to determine if they have been modified. How can I do this?
LVL 1
caddsmanAsked:
Who is Participating?
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?
0
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

      Next
0
frodomanCommented:
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
      Next

0

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
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Bob LearnedCommented:
That's what you get for 5 minutes of coding in the comment block without testing.
0
frodomanCommented:
Well, we've all done that 1 or 2 (thousand) times ;-)
0
caddsmanAuthor Commented:
Oops, sorry frodoman. I meant to give yo the points. :(
0
Bob LearnedCommented:
You can always have a moderator fix this.  Ask in Community Support to have this question fixed.
0
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.
0
frodomanCommented:
caddsman,

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.

Cheers,

Frodoman
0
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.