Solved

Accessing textboxes within a groupbox

Posted on 2003-12-03
10
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Stressed Out?

Watch some penguins on the livecam!

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 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