• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

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?
0
caddsman
Asked:
caddsman
  • 4
  • 3
  • 2
1 Solution
 
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now