Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.Net 2005 Change control default properties 1

Status
Not open for further replies.

Mootser13

Programmer
Sep 7, 2005
30
0
0
US
Stupid question:
How do I change the default properties for controls like a button ?
Every time I create a new form and add buttons I end up changing the Font size, and font type to something like size 11 and book antigua. I would like to set these properties as the default.
Or any other control properties.
I know there is a way to create my own controls and then inherit , but that doesn't seem to do what my in my mind should be easy.
 
One easy solution - but not I expect what you are really after - is to place a control on the form and set the porperties as you desire. Then when you need another of that type of control, just copy the existing control and paste it as a new control. The new control will have all of the same properties as the copied control, expect for the name.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Right now I am using some snippets to set the properties using code, but this is a little bit cumbersome to perform every single time.
 
I think I have found a way that I can live with.
I'll just set the form font , size and properties to the how I want it and the buttons lables will inherit those properties from the form.
 
Hence Christiaan's inheritence comment. Have a star chrissie1 [smile]

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Thank you.

But I think I was thinking of inheriting the controls and making new baby controls. Or perhaps I was thinking of something else.

Christiaan Baes
Belgium

"My old site" - Me
 
Either way the same principal applies. If you use inheritance of the form properties or create a "master" button and inherit from it, inheritance is the key to a successful and easily maintainable application....That was what my star was for.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top