How to create array of Form Items?

  • Thread starter Thread starter waltfish
  • Start date Start date
W

waltfish

Guest
In a form with multiple similar objects, say 10 CheckBoxes, is it possible to reference them as an array (e.g. CheckBox) rather than individually (e.g. CheckBox1, CheckBox2)?

thanks
 
Yes, just create an array of objects.

Draw a checkbox on your form, select it, press CTRL+C (copy), then click on the form so it has the focus, and press CTRL+V (paste) and it will ask you if you want to create an array of the same item.

Doing some will allow you to access them by CheckBox(0), CheckBox(1), etc.
 
Cert,

thanks for the reply. actually, i'm not prompted for array creation using this method. is there another way to create the array? btw, i'm using VB.NET to create a Windows Form Application.

thanks
 
In .net you will have to define an array of the type of your control.
You will have to addhandler for each event. There have been a
number of threads about this subject in this board and some very
good explanations.
 
It's likely that in the next version of VS.NET the designers will support control arrays natively.

As an aside, Microsoft, in the latest beta, have already implemented Windows Forms Designers for MC++. Impressive.
 
Back
Top