labels collections

  • Thread starter Thread starter Bhadan
  • Start date Start date
B

Bhadan

Hello,

I wish to create a collection from labels on a form.
I know the form has a control setting.
But I wish to access specifically numbered lables only ( label20 to
label50);
any advice is appreciated.

TIA,
Bhads.
 
Hello,

I wish to create a collection from labels on a form.
I know the form has a control setting.
But I wish to access specifically numbered lables only ( label20 to
label50);
any advice is appreciated.

The Form.Controls collection can be indexed by name or ordinal:

Label l1 = (Label) this.Controls[3];

or

Label l2 = (Label) this.Controls["label20"];
 
Bhadan said:
I wish to create a collection from labels on a form.
I know the form has a control setting.
But I wish to access specifically numbered lables only ( label20 to
label50);
any advice is appreciated.

Create an array:

Label[] labels

There's no good designer support for that, unfortunately, but it's the
most natural way of doing things IMO.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top