Solved

# Control Array

Posted on 2004-10-27
227 Views
Hi:
Is there a property or object that keeps track of the total number of items in a control array?
0
Question by:LearningJava

LVL 85

Accepted Solution

Sure.  If you had a textbox control array called text1, you could determine the number of textboxes in it like this:

Private Sub Command1_Click()
Dim arrayCount As Integer
arrayCount = Text1.Count
MsgBox arrayCount & " TextBoxes in Control Array Text1"
End Sub

~IM
0

LVL 48

Expert Comment

A Mini Control Array Management
--------------------------------------------
Processing a Control Array

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20174598.html

Range of Control Array Indexes

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_10261311.html

Count ,Highest and Lowest Index

YourControl.ubound = upper bound
YourControl.lbound = lower bound
YourControl.count = total number of coontrols in array

0

Author Comment

Idle Mind:
What is count? A property? Please elaborate.
0

LVL 48

Expert Comment

am i involved in this question?
0

LVL 48

Assisted Solution

The Count is the Total number of Controls in your Array

A Property is a Attribute to your Control.

For example.

The Color or text is a Property of your Control
0

LVL 85

Expert Comment

Right.

It's one of the properties exposed by a control array which Mikal613 already listed:

Text1.LBound ' The index of the last textbox in the control array
Text1.UBound ' The index of the first textbox in the control array
Text1.Count   ' The number of textboxes in the control array

There is one more:

Text1.Item     ' Used to access the individual items in the array

but usually you don't see .Item() used since the following two lines are equivalent:

Text1(1).Text = "something"
Text1.Item(1).Text = "something"

~IM
0

LVL 4

Assisted Solution

Suppose you have an array of TextBox controls named txtArray , then

'Total no of items in the control array

MsgBox "No of Items in the Control Array=" & txtArray.Count

'You can access individual array items as

For i=txtArray.LBound to txtArray.UBound
txtArray(i).Text="Item No: " & i
Next

~Ajith

0

## Featured Post

### Suggested Solutions

Introduction This article makes the case for using two modules in your VBA/VB6 applications to provide both case-sensitive and case-insensitive text comparison operations.  Recently, I solved an EE question using the LIKE function.  In order for th…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…