Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert string to property name? Pin
BDJones6-Dec-09 5:15
BDJones6-Dec-09 5:15 
QuestionSimple Example of using Enum Type why we use them? Pin
Rameez Raja5-Dec-09 18:24
Rameez Raja5-Dec-09 18:24 
AnswerRe: Simple Example of using Enum Type why we use them? Pin
PIEBALDconsult5-Dec-09 18:32
mvePIEBALDconsult5-Dec-09 18:32 
Questioninserting words into tablelayout Pin
someone295-Dec-09 15:53
someone295-Dec-09 15:53 
AnswerRe: inserting words into tablelayout Pin
Luc Pattyn5-Dec-09 16:21
sitebuilderLuc Pattyn5-Dec-09 16:21 
QuestionWhy does ReSharper implement Equals like this? Pin
CaptainSeeSharp5-Dec-09 15:16
CaptainSeeSharp5-Dec-09 15:16 
AnswerRe: Why does ReSharper implement Equals like this? Pin
N a v a n e e t h5-Dec-09 16:52
N a v a n e e t h5-Dec-09 16:52 
QuestionAdd a dynamic number of labels to form or panel Pin
bolikej5-Dec-09 12:54
bolikej5-Dec-09 12:54 
I'm trying to:

1st Create an array containing ref's to labels.
2nd Initiate them with a for loop and add some text to the label.
3d Add them to a panel with controls.add() either in the same loop or afterwards

The problem:
My code below sort of works but it will just add 1 control instead of 4 in my dummy example... what I'm I missing here??

I am aware I'm not setting any location Point prop's in the code below but im sure that isnt the problem...


private void btnExampleClick(object sender, EventArgs e)
{


Label[] lbl = new Label[4];

for (int i = 0; i < 4; i++)

{

lbl[i] = new Label();
lbl[i].Text = i.ToString();


}

foreach (Label x in lbl)
{
Controls.Add(x);

}

}
AnswerRe: Add a dynamic number of labels to form or panel Pin
Luc Pattyn5-Dec-09 13:00
sitebuilderLuc Pattyn5-Dec-09 13:00 
QuestionStopping remote services with WMI 'RPC not available' Pin
Jacob Dixon5-Dec-09 9:05
Jacob Dixon5-Dec-09 9:05 
AnswerRe: Stopping remote services with WMI 'RPC not available' Pin
Jacob Dixon5-Dec-09 9:15
Jacob Dixon5-Dec-09 9:15 
Questionmove the object Pin
machisiou5-Dec-09 5:48
machisiou5-Dec-09 5:48 
AnswerRe: move the object Pin
Luc Pattyn5-Dec-09 6:01
sitebuilderLuc Pattyn5-Dec-09 6:01 
QuestionClass Diagram Code Generation Pin
Randal Vance Cunanan5-Dec-09 5:39
Randal Vance Cunanan5-Dec-09 5:39 
AnswerRe: Class Diagram Code Generation Pin
Tony Richards5-Dec-09 5:59
Tony Richards5-Dec-09 5:59 
GeneralRe: Class Diagram Code Generation Pin
Randal Vance Cunanan5-Dec-09 6:03
Randal Vance Cunanan5-Dec-09 6:03 
GeneralRe: Class Diagram Code Generation Pin
0x3c05-Dec-09 6:38
0x3c05-Dec-09 6:38 
GeneralRe: Class Diagram Code Generation Pin
Randal Vance Cunanan5-Dec-09 11:58
Randal Vance Cunanan5-Dec-09 11:58 
GeneralRe: Class Diagram Code Generation Pin
Rozis5-Dec-09 13:18
Rozis5-Dec-09 13:18 
GeneralRe: Class Diagram Code Generation Pin
Randal Vance Cunanan5-Dec-09 16:21
Randal Vance Cunanan5-Dec-09 16:21 
GeneralRe: Class Diagram Code Generation Pin
0x3c05-Dec-09 19:55
0x3c05-Dec-09 19:55 
GeneralRe: Class Diagram Code Generation Pin
Randal Vance Cunanan5-Dec-09 19:57
Randal Vance Cunanan5-Dec-09 19:57 
GeneralRe: Class Diagram Code Generation Pin
harold aptroot5-Dec-09 6:56
harold aptroot5-Dec-09 6:56 
QuestionCustom text with Special Field inside Crystal Reports. Pin
Saksida Bojan5-Dec-09 4:53
Saksida Bojan5-Dec-09 4:53 
AnswerRe: Custom text with Special Field inside Crystal Reports. Pin
Natza Mitzi6-Dec-09 10:09
Natza Mitzi6-Dec-09 10:09 

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.