[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Declaring Property in VB.Net with child properties

Posted on 2003-10-31
5
Medium Priority
?
1,335 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
4 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Screencast - Getting to Know the Pipeline
Suggested Courses

829 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