Results 1 to 2 of 2

Thread: [RESOLVED] How to show merged properties between objects ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Rome, Italy
    Posts
    10

    Resolved [RESOLVED] How to show merged properties between objects ?

    Hi all,
    in VB.NET I have two classes with different properties, for example (pseudo code)

    class_A
    property text
    property color

    Class_B
    property text
    property width

    I have a designer where objects can be selected and edited.

    When I select an object of type Class_A, I can set the propertybox to show the property of Class_A, and when an object of Class_B is selected, then the property of Class_B are shown.

    The problem is that when both objects are selected, I would like to show only the common properties; in the above example, the propertybox should only show the property "text".

    How can I do this ?

    Thanks for your attention,
    Sergio.

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    Rome, Italy
    Posts
    10

    Re: How to show merged properties between objects ?

    Never mind, I've solved it.

    Example (not complete code)

    VB Code:
    1. Dim selectedprops(cnt) As Object 'Array of properties
    2.  
    3.         Try
    4.             For i = 0 To selected_objects - 1
    5.                  Dim theprop As Object
    6.  
    7.                 Select Case get_object_type(object_Selection(i))
    8.  
    9.                     Case MyType.textbox
    10.                         theprop = New my_Textbox
    11.  
    12.                     Case MyType.label
    13.                         theprop = New my_Label
    14.  
    15.                     Case MyType.checkbox
    16.                         theprop = New my_Checkbox
    17.  
    18.            
    19.                 End Select
    20.  
    21.                 If Not theprop Is Nothing Then
    22.                     selectedprops.SetValue(CType(theprop, Object), i)
    23.                 End If
    24.             Next
    25.  
    26.            
    27.            Me.PropertyGrid1.SelectedObjects = selectedprops
    Last edited by oigres; Oct 20th, 2005 at 07:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width