Click here to Skip to main content
15,881,882 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Nnamdi Onyeyiri Pin
Nnamdi Onyeyiri11-Oct-04 2:23
Nnamdi Onyeyiri11-Oct-04 2:23 
GeneralAssembly trust Pin
Member 14198426-Oct-04 1:22
Member 14198426-Oct-04 1:22 
GeneralRe: Assembly trust Pin
sreejith ss nair7-Oct-04 0:26
sreejith ss nair7-Oct-04 0:26 
GeneralRe: Assembly trust Pin
Member 14198427-Oct-04 3:34
Member 14198427-Oct-04 3:34 
Questionhow to handle a mass of lables in C#? Pin
momer5-Oct-04 22:20
momer5-Oct-04 22:20 
AnswerRe: how to handle a mass of lables in C#? Pin
benjymous5-Oct-04 23:30
benjymous5-Oct-04 23:30 
GeneralRe: how to handle a mass of lables in C#? Pin
momer6-Oct-04 16:51
momer6-Oct-04 16:51 
GeneralRe: how to handle a mass of lables in C#? Pin
benjymous6-Oct-04 21:47
benjymous6-Oct-04 21:47 
I'm not on a computer with C# on it atm, but what you need to do is this:

You can find out the type of the label by selecting the label in the form design view and noting down the name of it - then go back into your source and type that name - if you hover the mouse over it, the tooltip should tell you the type - I'm pretty sure it's Label though

Then you can just build the array like you would any other array

e.g.
class MyForm : Form
{
   ...
   Label[] labelList;  // Array holding the labels to modify
   const int NumLabels = 5;  // Number of labels in the array
   ...

   // Constructor for your form
   public MyForm()
   {
     ...
     // create and fill the label array - just using five in this example
     labelList = new Label[] { label1, label2, label3, label4, label5 };
     ...
   }

   public void DoSomethingWithLabels()
   {
     // loop through the array of labels
     for( int i=0; i<NumLabels; i++ )
     {
       // change the caption on this label
       labelList[i].Text = "Hello World!";
     }
   }
}


--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!

GeneralRe: how to handle a mass of lables in C#? Pin
momer9-Oct-04 15:42
momer9-Oct-04 15:42 
GeneralRe: how to handle a mass of lables in C#? Pin
User 25755210-Oct-04 19:08
User 25755210-Oct-04 19:08 
GeneralCombining languages Pin
Hadi Fakhreddine5-Oct-04 20:33
Hadi Fakhreddine5-Oct-04 20:33 
GeneralRe: Combining languages Pin
sreejith ss nair6-Oct-04 21:12
sreejith ss nair6-Oct-04 21:12 
GeneralRe: Combining languages Pin
Hadi Fakhreddine7-Oct-04 20:30
Hadi Fakhreddine7-Oct-04 20:30 
GeneralRe: Combining languages Pin
sreejith ss nair7-Oct-04 20:48
sreejith ss nair7-Oct-04 20:48 
QuestionWH_CBT GLOBAL Hook in .net? Pin
Hadi Fakhreddine5-Oct-04 20:29
Hadi Fakhreddine5-Oct-04 20:29 
GeneralQuestion for the .NET experts Pin
gvos5-Oct-04 15:55
gvos5-Oct-04 15:55 
GeneralRe: Question for the .NET experts Pin
sreejith ss nair6-Oct-04 21:13
sreejith ss nair6-Oct-04 21:13 
GeneralRe: Question for the .NET experts Pin
sreejith ss nair7-Oct-04 3:12
sreejith ss nair7-Oct-04 3:12 
GeneralData Grid columns Pin
janigorse4-Oct-04 19:36
janigorse4-Oct-04 19:36 
GeneralRe: Data Grid columns Pin
Anonymous5-Oct-04 13:48
Anonymous5-Oct-04 13:48 
GeneralRe: Data Grid columns Pin
HyVong8-Oct-04 8:47
HyVong8-Oct-04 8:47 
Generalmsgbox in form.load/activate causes form to close Pin
dmbf1b54-Oct-04 14:45
dmbf1b54-Oct-04 14:45 
GeneralAcceptButton and KeyEvents Pin
Gigiwig4-Oct-04 8:30
Gigiwig4-Oct-04 8:30 
GeneralRe: AcceptButton and KeyEvents Pin
sreejith ss nair7-Oct-04 1:09
sreejith ss nair7-Oct-04 1:09 
GeneralMobileIT Pin
hxxbin4-Oct-04 7:01
hxxbin4-Oct-04 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.