Control Arrays

rctaubert

Member
Joined
Aug 22, 2004
Messages
24
Programming Experience
10+
I have move an application from VB6 to VB.net. In VB6 I used Control Arrays (an array of Labels). Through articles I have found on various Forums I have been able to re-create control arrays in VB.net.

I have successfully recoded everything in VB.net but have two questions:

1) Can I add custom properties to a class based on Labels? How?

2) I cannot find a way to have the Label.Click event return the Index of the Label clicked. Any suggestions.

My thanks to anyone who can help me with this.
 

Schenz

Well-known member
Joined
Sep 11, 2004
Messages
181
Location
Cincinnati, OH
Programming Experience
5-10
I'll attempt to answer your questions by pointing you to other articles.

1) Can I add custom properties to a class based on Labels? How?
Yes, Subclass them.
See: http://www.ftponline.com/vsm/2004_10/magazine/features/jberes/

2) I cannot find a way to have the Label.Click event return the Index of the Label clicked. Any suggestions.
I'm not sure how you implemnted your version of a control array, but I would suggest looking at the sender argument of the click event.
See: http://visualbasic.about.com/library/bldykctrlarraya.htm
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
shyt, instead of control arrays, i'd suggest useing the label collection, i dont have any knowledge, but in my advanced vb.net class (we're gonna get into collections in a month) the teacher's already told us that in .net though arrays are fully support we should use collections above arrays cause of the support behind them
 
Top Bottom