Setting Custom Properties in VB?
-
I have created a custom WinForms control in VS2010. Within the control is a label, and I would like to be able to change the text of that label after placing the control in another application, without having to use the line: <MyControl>.Controls.Item("label1").Te… = "Hello, I'm a label" I figured the best way to go about this was probably to add a new property to the main UserControl that can change the text of the label through simpler code. But how would I do this? Also, a side question: How would I go about changing the toolbox icon of the control? Thanks. P.S.: Sorry if these questions sound a bit 'noobish'... While I have been developing in VB and C# for years, I have barely touched UserControls. And I'd rather not have to make my own components for something like this, since that would probably over-complicate it further.
-
Answer:
You will want to add a Property to your user control. The Get for the property will return label1.Text. Set will assign Value to label1.Text. See first link. Find the section titled "Adding Properties to Your User Control" To change the toolbox icon, see second link.
Cameron at Yahoo! Answers Visit the source
Related Q & A:
- How to refresh the Properties Window programatically?Best solution by Stack Overflow
- how to fetch a value from persistence.xml to build.properties?Best solution by Stack Overflow
- How to change folder properties inside a sharepoint library?Best solution by SharePoint
- How to Convert Code from VB to C++?Best solution by Stack Overflow
- How to save from DatagridView to Database VB.NET?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.