Solved

Accessing textboxes within a groupbox

Posted on 2003-12-03
10
294 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
That's what you get for 5 minutes of coding in the comment block without testing.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 42

Expert Comment

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

Author Comment

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

Expert Comment

by:Bob Learned
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now