Solved

Creating a custom control and setting properties?

Posted on 2014-03-28
2
213 Views
Last Modified: 2014-04-01
I was wondering what setting, if it exists, that allows you to change specific properties for all the controls within a custom control. In other word if I want all the sub-controls to be bold...how do I set the custom control to reflect that?

Thanks!
0
Comment
Question by:BlakeMcKenna
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39963292
If by custom control you mean a UserControl, then the following explain how to do it.

For some properties, such as the Font, if you set the UserControl Font in design, the controls you put on it will have the same font by default. You can also change the property in the code, and all controls that have the default Font will follow the change.

For other properties, you will have to loop through the controls with code such as the following:

            For Each ctl As Control In Me.Controls
                  ctl.Text = "New Text"
            Next
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 39969204
Thanks James...that's what I needed!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now