Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

Control arrays


Hi all,

I would like to know what is the best way to create control arrays of Labels
and be able to index them? I am a former VB6 programmer that was used to
plopping controls on the form and have the arrays created automatically.
Please provide a snippet of code or good reference site on C# on how to do
this thanks.

"Joseph" <Jos@discussions.microsoft.com> wrote in message

news:9945846B-5C84-4DD2-9443-EB1FBC8944AF@microsoft.com...

> Hi all,

> I would like to know what is the best way to create control arrays of
> Labels
> and be able to index them? I am a former VB6 programmer that was used to
> plopping controls on the form and have the arrays created automatically.
> Please provide a snippet of code or good reference site on C# on how to do
> this thanks.

There's a couple of different ways (which are basically the same). The first
is to plonk the controls on the form as normal and then create an array of
labels and populate it yourself

Label _LabelArray = new Label[3];
_LabelArray[0] = Label0;
_LabelArray[1] = Label1;
etc

The second is to create the labels yourself and populate the above array.

This is more work than VB6 but provided much greater functionality. The vb6
control arrays were not that good for a few reasons.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc