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

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2005
Posts: 70
Reputation: Diode is on a distinguished road 
Solved Threads: 0
Diode's Avatar
Diode Diode is offline Offline
Junior Poster in Training

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

 
0
  #1
Apr 22nd, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

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

 
0
  #2
May 3rd, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 6
Reputation: guino is an unknown quantity at this point 
Solved Threads: 0
guino guino is offline Offline
Newbie Poster

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

 
0
  #3
May 9th, 2006
you can also do it with:

Me.Controls.AddRange(Control[] myControlArray)

and you have your problem solved.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1
Reputation: james4560 is an unknown quantity at this point 
Solved Threads: 0
james4560 james4560 is offline Offline
Newbie Poster

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

 
0
  #4
Sep 7th, 2008
Try
http://freevbcode.t35.com/ControlArray.html

it helped me with control arrays
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC