creating label control arrays

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am working with one Window based application in C#. I want to create label control arrays, say instead of label1, label2, label3 i need to have it as label[1..3]

So please let me know how to create label arrays using C#. I believe this is possible with VB or VB.NET. But i am not whether it is possible with C#, but i need to do this with C#

Thanks in advance..

Thanks
Rajagopal.S
 
Control Arrays don't exist in .NET. however, you can simulate the
functionalityb by adding handlers for each of the other controls.

So :

this.label1.Click += new System.EventHandler(this.label1_Click);

this.label2.Click += new System.EventHandler(this.label1_Click);

this.label3.Click += new System.EventHandler(this.label1_Click);

Raju said:
Hi,

I am working with one Window based application in C#. I want to create
label control arrays, say instead of label1, label2, label3 i need to have
it as label[1..3].
So please let me know how to create label arrays using C#. I believe this
is possible with VB or VB.NET. But i am not whether it is possible with C#,
but i need to do this with C#.
 
Hi Raju,

Do you mean this?

{Label[] labelAr = {label1,label2,label3};
labelAr[1].BackColor = Color.Red;}

Cor
I am working with one Window based application in C#. I want to create
label control arrays, say instead of label1, label2, label3 i need to have
it as label[1..3].
So please let me know how to create label arrays using C#. I believe this
is possible with VB or VB.NET. But i am not whether it is possible with C#,
but i need to do this with C#.
 
Back
Top