|
-
Aug 18th, 2003, 12:25 AM
#1
Thread Starter
Lively Member
.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
-
Aug 18th, 2003, 01:21 AM
#2
Frenzied Member
VB Code:
Private _age As Int32
Property Age() As Int32
Get
Return _age
End Get
Set(ByVal Value As Int32)
_age = Value
End Set
End Property
-
Aug 18th, 2003, 01:28 AM
#3
Thread Starter
Lively Member
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
-
Aug 18th, 2003, 07:02 AM
#4
Frenzied Member
I think you might have to use attributes.
-
Aug 18th, 2003, 09:22 AM
#5
Fanatic Member
You need to use the System.ComponentModel namespace like:
VB Code:
<System.ComponentModel.Category("NameOfYourCategoryGoesHere")> _
You can also set the description, etc.
-
Aug 18th, 2003, 05:48 PM
#6
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|