-
January 30th, 2010, 12:34 AM
#1
[RESOLVED] TextBoxes and Lables as an array????
Hello! I have a simple query that suppose I have to put values on the lables from a array so instead of writing individual names for assigning values in lables from an array...can I treat Lables as Arrays so that i recogise them by its index for an example.....Here is unmanaged or untrue code....
Code:
label1= a[i];
i++;
label2=a[i];
i++;
label3=a[i];
//So Instead Of above code Is there any way to Use the method of following example??
for(i=0;i<9;i++)
{
label[i]=a[i];
}
Thanks......
-
January 30th, 2010, 03:19 AM
#2
Re: TextBoxes and Lables as an array????
Code:
List<Label> labels = new List<Label>( );
labels.Add( new Label( ) );
labels.Add( new Label( ) );
labels.Add( new Label( ) );
int i = 1;
foreach( Label label in labels )
{
label.Text = String.Format( "Label #{0}", i );
++i;
}
-
January 31st, 2010, 03:20 AM
#3
Re: TextBoxes and Lables as an array????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|