I am trying to duplicate the Control Arrays of VB6 in VB.Net.
For example, on a form, I have 4 Text Boxes; in the ToolBox of VB.Net, there is a TextBoxArray control that I can add to the VB.Net form I am creating.
How do I populate the TextBoxArray, such as to include in it the 4 Text Boxes I have put on my form such that I can access them programmatically afterwards ?
I suppose it can be done using the Form Designer, identifying each of the Text Boxes that will be tied to the TextBoxArray, but what is the sequence of actions to get there ? (as far as possible, I want to avoid doing this programmatically).
Once I know how to operate with a TxtBoxArray, I imagine the sequence will be the same for any other Control Array.
It seems as if you have used the Upgrade Wizard to upgrade your existing VB 6 project to VB.NET.
Now, because of this you sit with a declaration that looks more or less like this :
Public WithEvents TextBoxArrayName As Microsoft.VisualBasic.Compatibility.VB6.TextBoxArray
The _TextBoxArrayName_n are actually normal textbox controls that are added to the array at design time.
This is not, I repeat not the way to go!
Do not upgrade your projects!
In .NET there is no Control Array feature. You can still though, let different controls share the same sub procedure with the Handles clause. .NET deals with Collections, where every object is part of a collection.
Here is a 3 part article listing all the differences between VB 6 and .NET :