Solved

Accessing textboxes within a groupbox

Posted on 2003-12-03
10
300 Views
Last Modified: 2012-05-04
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
Comment
Question by:caddsman
  • 4
  • 3
  • 2
10 Comments
 
LVL 1

Author Comment

by:caddsman
ID: 9869314
For clarification, how do I access the textboxes within the groupbox and determine if those textboxes have been modified?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9869317
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
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 9869348
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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 9869369
That's what you get for 5 minutes of coding in the comment block without testing.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9869431
Well, we've all done that 1 or 2 (thousand) times ;-)
0
 
LVL 1

Author Comment

by:caddsman
ID: 9869850
Oops, sorry frodoman. I meant to give yo the points. :(
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9869896
You can always have a moderator fix this.  Ask in Community Support to have this question fixed.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9870181
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
 
LVL 42

Expert Comment

by:frodoman
ID: 9870229
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question