Hello, I am having trouble grasping the whole concept around collections. I was just wondering if i could get a different point of view or an example.. Thanks
Printable View
Hello, I am having trouble grasping the whole concept around collections. I was just wondering if i could get a different point of view or an example.. Thanks
As I understand it collections include different items for example on your form. There could be a collection of textboxes or commandbuttons. It can be usefull when you want to set values to all textboxes or other controls on your form. You would simply set up a loop that accounted for each item in the collection of textboxes. Hope this helps :-)
MPrestonf12: I think you are referring to Arrays.
mpSmooth: A collection is basically used to organize data together. For example, if you needed to keep track of peoples name's, you could use a collection for it.
In the above example, (assuming you have a TextBox), whatever is entered in the TextBox would be entered in the collection; like a record.Code:MyCollection.Add Text1
I think MPrestonf12 is refering to Controlarrays
Collections are linked lists, sort of like arrays, but slower when it comes on accessing and faster when it comes to adding and removing items. Therefore i don't recommend you use it unless you are adding and removing items frequently.
I understand what you are saying, thank you for clearing things up. I just was never sure when to use an array or a collection. Thanks again...