Help User Control

  • Thread starter Thread starter Nicolaus OC
  • Start date Start date
N

Nicolaus OC

How to create a group of property in a user control.
for examples size have two property width and height
thanks for helping..

best Regrads
NOC
 
Hi Nicolaus,

Creating a Property in a UserControl is exactly the same as in any other
class.

Public Property Foo As FooType
Get ...
Set ...
End

If this the sort of Property you mean but with a compound value like Size:

Private _Size As Size

Property Width As Integer
Get
Return _Size.Width
End Get
Set
_Size = New Size (Value, _Size.Height)
End Set
End Property

Property Height As Integer
Get
Return _Size.Height
End Get
Set
_Size = New Size (_Size.Width, Value)
End Set
End Property

But I also wonder whether you mean one that can be displayed in the
Properties box at Design Time?

Regards,
Fergus
 
Thanks.. fergus.
with that way can i display my property in property box?
How Can i do that?

best regards,
NOC
 
* "Nicolaus OC said:
with that way can i display my property in property box?
How Can i do that?

\\\
Public Property MyPosition() As Point
Get
...
End Get
Set(...)
...
End Set
End Property
///

Will add a property called 'MyPosition' of type 'Point' to your control.
 
Back
Top