944,181 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 9801
  • VB.NET RSS
Apr 22nd, 2006
0

I am needing a control array, but VB.NET doesn't support them...

Expand Post »
Quote ...
In Visual Basic 6.0, control arrays could be used to specify a group of controls that shared a set of events. The controls had to be of the same type, and they had to have the same name.

In Visual Basic .NET, control arrays are no longer supported. Changes to the event model make control arrays unnecessary. Just as control arrays in Visual Basic 6.0 could share events, the event model in Visual Basic .NET allows any event handler to handle events from multiple controls. In effect, this allows you to create groups of controls of disparate types that share the same events.
That came straight out of the MSDN Library. God those control arrays were so handy.

What I'm wanting to do is
1. read all the records from a sequential access text file
2. put them into a string array

I can do these first two, but then I'm wanting to create enough label controls to display all the records, one record per label. You could do this in VB 6.0. God I loved that version.

I thought the purpose of OOP was to make it more efficient and less time-consuming, especially for newer and "better" versions of languages/compilers. It seems in this regard, VB is taking a step backward toward more primitive times. But perhaps I am an idiot and there is something about this I am not aware of about their reasons for doing this.

The bottom line is, I don't know how many records there are going to be, and I want to be able to put my data in my string array into its respective label control, but VB.NET no longer supports INDEX properties.

What can I do?

Thanks.
Similar Threads
Reputation Points: 50
Solved Threads: 0
Junior Poster in Training
Diode is offline Offline
70 posts
since Jan 2005
May 3rd, 2006
0

Re: I am needing a control array, but VB.NET doesn't support them...

This site has as good a solution as I have seen and is one that I use.
http://www.codeproject.com/vb/net/Control_Arrays.asp
If you have any question I will try to help.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
May 9th, 2006
0

Re: I am needing a control array, but VB.NET doesn't support them...

you can also do it with:

Me.Controls.AddRange(Control[] myControlArray)

and you have your problem solved.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
guino is offline Offline
6 posts
since Jan 2006
Sep 7th, 2008
0

Re: I am needing a control array, but VB.NET doesn't support them...

Try
http://freevbcode.t35.com/ControlArray.html

it helped me with control arrays
Reputation Points: 10
Solved Threads: 0
Newbie Poster
james4560 is offline Offline
1 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Get Url From IE
Next Thread in VB.NET Forum Timeline: functions in the class file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC