Click here to Skip to main content
16,004,906 members
Home / Discussions / C#
   

C#

 
GeneralRe: A beginners question Pin
RedPhoenix.net1-Nov-07 8:05
RedPhoenix.net1-Nov-07 8:05 
AnswerRe: A beginners question Pin
Guffa1-Nov-07 8:30
Guffa1-Nov-07 8:30 
GeneralRe: A beginners question Pin
duncanmhor1-Nov-07 10:52
duncanmhor1-Nov-07 10:52 
GeneralRe: A beginners question Pin
NewToAspDotNet1-Nov-07 11:46
NewToAspDotNet1-Nov-07 11:46 
GeneralRe: A beginners question Pin
duncanmhor1-Nov-07 12:06
duncanmhor1-Nov-07 12:06 
GeneralRe: A beginners question Pin
Paul Conrad1-Nov-07 15:50
professionalPaul Conrad1-Nov-07 15:50 
QuestionAcces multiple components. Pin
ev00l1-Nov-07 4:45
ev00l1-Nov-07 4:45 
AnswerRe: Acces multiple components. Pin
Luc Pattyn1-Nov-07 5:23
sitebuilderLuc Pattyn1-Nov-07 5:23 
Hi,

Q1.
You could use Visual Designer to compose the maximum complexity, then hide what you
don't need. But that is a lot of work, and generates a lot of code, and leads to all
kinds of Control names.

I find it easier to write code to do that, so I would generate the Controls at run-time;
this means your code has to set all relevant properties, in particular Location.
If you do it in a loop, you can store all these Controls in a collection (an array,
an ArrayList, a List< DateTimePicker>, whatever)

Sometimes I tend to create one Control with Designer, then write code to Clone() that
one, adjust its properties, etc. That way, you can design and see the properties for
your Control prototype.

Q2.
If created at run-time, the Controls don't have individual variable names, but reside
in a collection (array, ArrayList,..) which you can enumerate with a for loop or a
foreach loop.

Otherwise, you could:
- enumerate all the Form's Controls (thru Controls property) and skip the ones you don't
need;
- or create a collection once (new array or ArrayList, then add the references), then
enumerate as much as you like.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google


GeneralRe: Acces multiple components. Pin
ev00l1-Nov-07 6:26
ev00l1-Nov-07 6:26 
GeneralRe: Acces multiple components. Pin
Luc Pattyn1-Nov-07 7:05
sitebuilderLuc Pattyn1-Nov-07 7:05 
QuestionVS05 Pin
Gene_Sheppard1-Nov-07 4:22
Gene_Sheppard1-Nov-07 4:22 
AnswerRe: VS05 Pin
led mike1-Nov-07 5:46
led mike1-Nov-07 5:46 
GeneralRe: VS05 Pin
mav.northwind1-Nov-07 7:19
mav.northwind1-Nov-07 7:19 
GeneralRe: VS05 Pin
led mike1-Nov-07 7:52
led mike1-Nov-07 7:52 
GeneralRe: VS05 Pin
mav.northwind1-Nov-07 8:48
mav.northwind1-Nov-07 8:48 
GeneralRe: VS05 Pin
led mike2-Nov-07 5:32
led mike2-Nov-07 5:32 
GeneralRe: VS05 Pin
mav.northwind2-Nov-07 9:52
mav.northwind2-Nov-07 9:52 
GeneralRe: VS05 Pin
led mike2-Nov-07 9:58
led mike2-Nov-07 9:58 
GeneralRe: VS05 Pin
mav.northwind2-Nov-07 10:07
mav.northwind2-Nov-07 10:07 
GeneralRe: VS05 Pin
led mike2-Nov-07 10:37
led mike2-Nov-07 10:37 
QuestionDeployment scenarios Pin
Symeonb1-Nov-07 4:14
Symeonb1-Nov-07 4:14 
AnswerRe: Deployment scenarios Pin
Justin Perez1-Nov-07 4:42
Justin Perez1-Nov-07 4:42 
GeneralRe: Deployment scenarios Pin
Symeonb5-Dec-07 23:02
Symeonb5-Dec-07 23:02 
QuestionCompact Flash port access? Pin
Honken69691-Nov-07 2:56
Honken69691-Nov-07 2:56 
QuestionSave a System.Drawing.Graphics graphic as *.bmp Pin
Manfr3d1-Nov-07 2:34
Manfr3d1-Nov-07 2:34 

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.