Results 1 to 6 of 6

Thread: .NET Windows Control Custom Property

  1. #1

    Thread Starter
    Lively Member tgoodmannz's Avatar
    Join Date
    Sep 2000
    Location
    Mid On at the Pavillion End
    Posts
    102

    .NET Windows Control Custom Property

    Hi,

    I'm sure this is easy but I can't seem to find it in the M$ Doco....

    How can I add a custom property to a VB.NET Windows control?

    I previously used the Add Property wizard in VB6 ... how do I do it in VB.NET???

    Thanks!

    Tim

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    VB Code:
    1. Private _age As Int32
    2.  
    3. Property Age() As Int32
    4.     Get
    5.           Return _age
    6.     End Get
    7.     Set(ByVal Value As Int32)
    8.           _age = Value
    9.     End Set
    10. End Property

  3. #3

    Thread Starter
    Lively Member tgoodmannz's Avatar
    Join Date
    Sep 2000
    Location
    Mid On at the Pavillion End
    Posts
    102
    Thanks DevGrp ...

    Just to confirm .. I'm looking for Properties available at
    Design time .. when I added a class propertie it didn't seem to be available in the Forms designer ... can you confirm?

    Cheers,
    Tim

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    I think you might have to use attributes.

  5. #5
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    You need to use the System.ComponentModel namespace like:

    VB Code:
    1. <System.ComponentModel.Category("NameOfYourCategoryGoesHere")> _

    You can also set the description, etc.

  6. #6

    Thread Starter
    Lively Member tgoodmannz's Avatar
    Join Date
    Sep 2000
    Location
    Mid On at the Pavillion End
    Posts
    102
    Excellent! Thanks VBCC - I knew it would be easy ...

    For future reference the complete code looks like:

    Code:
     
        <System.ComponentModel.Description("The SOAP Header with the control"), _
        System.ComponentModel.Category("SOAPHeader")> _
        Public Property WebServiceSOAPHeader() As String
            Get
                Return mWSSOAPHeader
            End Get
            Set(ByVal Value As String)
                mWSSOAPHeader = Value
    
            End Set
        End Property
    Cheers,
    Tim

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