-
August 21st, 2010, 12:43 AM
#1
Populating a TextBoxArray in VB.Net
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.
Thanks for any tip. Azzar
-
August 21st, 2010, 02:54 AM
#2
Re: Populating a TextBoxArray in VB.Net
Welcome to the Forums!
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 :
Code:
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 :
Comparison Between VB 6.0 and VB.NET Objects, Part 1
http://www.codeguru.com/vb/gen/vb_ge...le.php/c11081/
Comparison Between VB 6.0 and VB .NET Objects, Part 2
http://www.codeguru.com/vb/gen/vb_ge...le.php/c11311/
Comparison Between VB 6.0 and VB.NET Objects, Part 3
http://www.codeguru.com/vb/gen/vb_ge...le.php/c11535/
These are based on VB 2003, but they should in any case apply to whatever version of .NET you have.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|