![]() |
| | #1 |
| Registered User Join Date: May 2005
Posts: 3
| Control array i seem to be having problems adding Control arrays to a Panel. this is how i am doing it, Code: Label[] la = new Label[5]; la[0].Text = "label text"; Panel1.Controls.Add(la[0]); thanks for your help. |
| pug is offline | |
| | #2 |
| Banned Join Date: Feb 2003 Location: Australia
Posts: 986
| You've allocated space for a new array, but you haven't actually allocated space for each item in the array. Try this: Code: Label[] labels = new Label[5]; labels[0] = new Label(); labels[0].Text = "Label 1!"; labels[1] = new Label(); labels[1].Text = "Label 2!"; labels[2] = new Label(); labels[2].Text = "Label 3!"; Panel1.Controls.AddRange(labels); |
| nickname_changed is offline | |
| | #3 |
| Registered User Join Date: May 2005
Posts: 3
| thanks for your reply, got it to work perfect |
| pug is offline | |
| | #4 |
| Banned Join Date: Feb 2003 Location: Australia
Posts: 986
| You're welcome ![]() My bill will be in the post. |
| nickname_changed is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| from 2D array to 1D array | cfdprogrammer | C Programming | 17 | 03-24-2009 10:33 AM |
| Personal Program that is making me go wtf? | Submeg | C Programming | 20 | 06-27-2006 12:13 AM |
| Unknown Memory Leak in Init() Function | CodeHacker | Windows Programming | 3 | 07-09-2004 09:54 AM |
| Quick question about SIGSEGV | Cikotic | C Programming | 30 | 07-01-2004 07:48 PM |
| Array Program | emmx | C Programming | 3 | 08-31-2003 12:44 AM |