473,396 Members | 2,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is a collection item's index number fixed.?

Hi all.
Could someone tell me is this number fixed when the item is created, or can
it be changed?

So for example if there are three forms, with index 0,1,2
and form 1 is deleted, does form with index 2, now get index 1?

Is the answer different depending on what the object is, eg Form or control.

Thanks in advance.

Gerry


Nov 12 '05 #1
3 5735
If you delete an item from a collection, the index of all the later items
reduces.

Using the Forms collection as an example, if you have 4 forms open, they
will be Forms(0) to Forms(3). If you close Forms(2), then Forms(3) becomes
Forms(2).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:w3*******************@news.indigo.ie...
Hi all.
Could someone tell me is this number fixed when the item is created, or can it be changed?

So for example if there are three forms, with index 0,1,2
and form 1 is deleted, does form with index 2, now get index 1?

Is the answer different depending on what the object is, eg Form or

control.
Nov 12 '05 #2
Thanks Allen,

So if the form is not open, then it's not part of the collection?

Gerry
"Allen Browne" <ab***************@bigpond.net.au> wrote in message
news:Rs*******************@news-server.bigpond.net.au...
If you delete an item from a collection, the index of all the later items
reduces.

Using the Forms collection as an example, if you have 4 forms open, they
will be Forms(0) to Forms(3). If you close Forms(2), then Forms(3) becomes
Forms(2).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:w3*******************@news.indigo.ie...
Hi all.
Could someone tell me is this number fixed when the item is created, or

can
it be changed?

So for example if there are three forms, with index 0,1,2
and form 1 is deleted, does form with index 2, now get index 1?

Is the answer different depending on what the object is, eg Form or

control.

Nov 12 '05 #3
That is correct.

In Access 2002, you can get the names of the forms from this collection:
CurrentProject.AllForms
Again, the index numbers change if forms are deleted.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:pw*******************@news.indigo.ie...
Thanks Allen,

So if the form is not open, then it's not part of the collection?

Gerry
"Allen Browne" <ab***************@bigpond.net.au> wrote in message
news:Rs*******************@news-server.bigpond.net.au...
If you delete an item from a collection, the index of all the later items reduces.

Using the Forms collection as an example, if you have 4 forms open, they
will be Forms(0) to Forms(3). If you close Forms(2), then Forms(3) becomes Forms(2).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:w3*******************@news.indigo.ie...
Hi all.
Could someone tell me is this number fixed when the item is created,
or can
it be changed?

So for example if there are three forms, with index 0,1,2
and form 1 is deleted, does form with index 2, now get index 1?

Is the answer different depending on what the object is, eg Form or

control.


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Scott | last post by:
I have a collection where the items in the collection are dates. I want to iterate over the collection and build a value list string for the rowsource of a listbox. The dates in the collection are...
2
by: S. Justin Gengo | last post by:
Hi, I've created a component that allows me to store database information for various types of databases my company uses. It uses a collection for each type of database. Everything is working...
4
by: Michael K. Walter | last post by:
I'd like to create a strongly-typed collection of objects that are indexed by a string value (key is a string). I'd also like to allow users to iterate over the collection using a For-each loop...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
14
by: Rich | last post by:
Yes, I need to store some values in an array type collection object that can hold 3 or more parameters per index. I have looked at the collection object, hashtable object and would prefer not to...
6
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
3
by: Senna | last post by:
Hi Have these to work with. int counter = 0; //The total item to fill the collection with int increment = 2; //Any number int current = 244; //Quantity int max = 1290; //Max Quantity int...
6
by: Erick | last post by:
I've created a class called Procs and a collection class called Processes which uses a hastable object to store the Procs. Now i want to enumerate with the "For each" to extract all the Procs in...
7
by: Dale | last post by:
I have a design question. I am creating a custom collection of products. The unique key for the products is productId which is an integer. By default, IndexOf(object obj), when obj is an int,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.