let say i need to create a cpu simulator and i need 32 registers, to make the demonstration i need 32 labels and let say i want those labels background color to be white, what should i do to avoid repetation of setting properties to labels?

Recommended Answers

All 10 Replies

You can write below code and call it in form load or in the constructor.
Just a demonstration.

foreach(Control c in Controls)
{
if ( c is Label )
{
c.BackColor = Color.White;
}
}

You can write below code and call it in form load or in the constructor.
Just a demonstration.

foreach(Control c in Controls)
{
if ( c is Label )
{
c.BackColor = Color.White;
}
}

nice idea indeed.

And I think it's the only solution if you don't need to use Themes, etc.. because .net controls is sealed; you can't inherit from and do some changes.

And I think it's the only solution if you don't need to use Themes, etc.. because .net controls is sealed; you can't inherit from and do some changes.

how do you use theming in windows app?

1- Search on theming and skeining product and see the read me file.
Really, I didn't use such methodology in work, usually I don't interfere with UI process.

to avoid repetation of setting properties to labels?

After Ramy posted you a snippet you said : nice idea.
Ramy was setting properties to controls, is that not a contradiction with your first post?
Anyway, this snippet might also help you out :
http://www.daniweb.com/code/snippet1171.html

P.S.
Btw. your guitar playing is not bad at all;)

After Ramy posted you a snippet you said : nice idea.
Ramy was setting properties to controls, is that not a contradiction with your first post?
Anyway, this snippet might also help you out :
http://www.daniweb.com/code/snippet1171.html

P.S.
Btw. your guitar playing is not bad at all;)

thanks, i bought a sennheizer microphone for 110 dolars with its stand cable and converters it costed 230 dolars, now i will be able to record songs more clearly, but i dont have time to improve those stuff..

Danny, send me the link of some of his videos. Let's think in something else coding :D

Danny, send me the link of some of his videos. Let's think in something else coding :D

i removed them recently, but i will add new ones when i get my freaking hp laptop's microphone fixed. I need to learn how to record guitar first, some software and hardware equipment maybe. i put this task in my mind queue, soon as possible i will share dont worry.

Yeah, what is it with this thread? Is it solved? Serkan?
We can't start a guitar forum here. I think Dani would not like that very much to say the least;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.