Solved

Declaring Property in VB.Net with child properties

Posted on 2003-10-31
5
1,321 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
[X]
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
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 127
Starting to use Git with Visual  Studio Online 1 71
Data Analysis 7 59
Binding a GridView in ASP.NET(VB) using Using statements 6 19
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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