Naming object on a form

G

Guest

Hi, I could in Delphi name labels with a number like lblName(1).
This is useful when I'm making functions, it can be used like this:

int i = 0;
if ( a > b)
{
i = 1;
}
lblName(i).Text ="This is a great number";

Is it possible to do something like this, without making a list of objects ?
 
J

Jon Skeet [C# MVP]

<=?Utf-8?B?S2Fyc3RlbiBMdW5kc2dhYXJk?= <Karsten
Hi, I could in Delphi name labels with a number like lblName(1).
This is useful when I'm making functions, it can be used like this:

int i = 0;
if ( a > b)
{
i = 1;
}
lblName(i).Text ="This is a great number";

Is it possible to do something like this, without making a list of objects ?

No (or at least, not cleanly) - but what do you have against making a
list (or array) of labels?
 
G

Guest

Hi Jon, thanks for the help.

I have nothing against using a list, I would just like to now if there is an
easier way of doing it.

Regards

Karsten
 

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

Top