Solved

Declaring Property in VB.Net with child properties

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
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:…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

17 Experts available now in Live!

Get 1:1 Help Now