Solved

Declaring Property in VB.Net with child properties

Posted on 2003-10-31
5
1,316 Views
Last Modified: 2008-03-17
how to declare a property in VB.Net with child properties (to get an expandable property in the property panel, like the 'size' property of a form that has two child: width & heigth)?
0
Comment
Question by:the-edge
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:NetPointer
ID: 9661709
Try this.
Imports System.ComponentModel

<Category("Appearance"), DefaultValue("")> Property [Width](  ) As Integer
      Get
         Return _width
      End Get
 
      Set(ByVal Value As Integer)
         _width = Value
      End Set
   End Property

Here are the common attributes for property.
Bindable
Boolean. true indicates that VS .NET will display this control in the databindings dialog box.
 
Browsable
Boolean. Is the property displayed in the designer?
 
Category
Determines in which category this control will be displayed when the Properties dialog is sorted by category.
 
DefaultValue
The default value.
 
Description
The text you provide is displayed in the description box in the Properties panel.
0
 
LVL 4

Expert Comment

by:NetPointer
ID: 9661713
String.Replace("Appearance", "Size") in above post....

;)
Regards,
NetPointer
0
 
LVL 3

Author Comment

by:the-edge
ID: 9662347
NetPointer, first of all tanks for your interest.
I already know how to declare new category of property, what i'm looking for is a way to declare a property like the standard properties 'size' and 'location' that will show in the properties dialog this:

+ Size         180;120
+ Location   10;20

and when you click on the plus sign:

- Size          180;120
     Width     180
     Heigth    120
- Location    10;20
     X           10
     Y           20


I want:

+ myProperty       80;100

- myProperty       80;100
      myChild1       80
      myChild2       100

hope i was clear

the edge
0
 
LVL 3

Accepted Solution

by:
the-edge earned 0 total points
ID: 9677060
ok i've found a solution!

Property myProp (  ) As Size
      Get
         Return _myProp
      End Get
 
      Set(ByVal Value As Size)
         _myProp= Value
      End Set
   End Property

this will show, in the property panel:
______________________
|- MyProp    |    180;120   |
|     Width    |   180          |
|     Heigth   |   120          |
|-----------------------------|

the edge
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Latency in .net app using DB in .net 21 31
C# Single Form 8 28
Automated testing suggestions? 2 28
Crystal reports vb.net 2 16
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

896 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

19 Experts available now in Live!

Get 1:1 Help Now