PC Review


Reply
Thread Tools Rate Thread

Control Limit

 
 
Richard Grene
Guest
Posts: n/a
 
      2nd Oct 2003
When looping through controls on a form, there seems to be a limit of 57,
even though there are 75 on the form. This is the code:
Dim sControl As Control

For Each sControl In Me.Controls

next sControl

I looked at the Forms designer Generated Code and me.Controls.AddRange only
contains 57 out of the 75 controls.

Any ideas.

Thanks,
Richard




 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      2nd Oct 2003
"Richard Grene" <(E-Mail Removed)> scripsit:
> When looping through controls on a form, there seems to be a limit of 57,
> even though there are 75 on the form. This is the code:
> Dim sControl As Control
>
> For Each sControl In Me.Controls
>
> next sControl
>
> I looked at the Forms designer Generated Code and me.Controls.AddRange only
> contains 57 out of the 75 controls.


This code will only enumerate the controls which are placed directly
onto the form, not the controls nested inside containers.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Tom Spink
Guest
Posts: n/a
 
      2nd Oct 2003
Hi, You're seeing this because you have controls as part of other controls,
e.g. checkboxes within a group box, or buttons in a panel (or of course
anything else where there are child controls in a parent control). If this
is the case, you need to perform a recursive search, which searches for
child controls within controls.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Chaos, Panic, Disorder, my work here is done"


"Richard Grene" <(E-Mail Removed)> wrote in message
news:ahCdneCbaMJ6GeGiXTWc-(E-Mail Removed)...
: When looping through controls on a form, there seems to be a limit of 57,
: even though there are 75 on the form. This is the code:
: Dim sControl As Control
:
: For Each sControl In Me.Controls
:
: next sControl
:
: I looked at the Forms designer Generated Code and me.Controls.AddRange
only
: contains 57 out of the 75 controls.
:
: Any ideas.
:
: Thanks,
: Richard
:
:
:
:


 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      2nd Oct 2003
Hi Richard,

If any of the Controls are contained within another Control, eg a Panel,
they will be in the Controls collection of the Panel rather than of the Form.

Regards,
Fergus


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CONTROL LIMIT James Microsoft Access 10 6th Sep 2007 03:54 AM
limit a control Karen Microsoft Access Forms 2 7th Apr 2005 10:55 PM
control limit? Brian Burgess Microsoft Dot NET Compact Framework 3 29th Oct 2003 05:06 PM
Re: Control Limit Keith G Hicks Microsoft Access Forms 1 11th Sep 2003 10:19 PM
Re: Control Limit on Reports Duane Hookom Microsoft Access Reports 0 11th Sep 2003 06:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:21 PM.