Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Declaring Property in VB.Net with child properties

Posted on 2003-10-31
5
1,319 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display

790 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