No, Event handlers is not the only reason we like control arrays.
Originally Posted by jmcilhinney
If I had 10 textboxes in an array and I had a single piece of code writing and reading from them then I'd only need one piece of code because it could switch from one box to the other simply by changing the index. For example code to clear all 10 boxes is as simple as this:-
The same code just loops round. if I wanted to edit the way the boxes are handled I'd just need to edit in one place.
Private Sub ClearBoxes()
Dim i as Integer
For i = 1 to 10
TextBox(i).Text = ""
Doing that to 10 separate boxes would take 10 separate lines of code and if I wanted to change the code I'd have to be careful that I changed all 10 places.
.Net allows me to very easily create an array of controls in code and use them exactly the same as I did in vb6 - so why doesn't it allow me to create them at design time.