Subject: User Controls
Posted By: Duncan Post Date: 10/23/2003 4:39:41 AM
Hi Guys

I'm creating a User Control, one of the controls required is a textbox. When I add the text box to the user control I can see all the usuall properties of the text box. But when I add the user control to the form in the project only some of the properties are visible. The property I require is the CharacterCasing, I can get this property to appear by adding a Public property to the user control code, but I keep getting an overflow error when setting the property.

<Category("Apperance"), Description("Sets text Casing"), Browsable(True), Defaultvalue("Normal")>_
Public Property Casing as CharacterCasing
Get
Return Casing
End Get
Set (ByVal Value as CharacterCasing)
Casing = Value
End set
End Property

A Little help required, Thanks

Duncan
Reply By: planoie Reply Date: 10/27/2003 11:51:40 AM
Your overflow is most likely being caused by the circular reference in the property:

Public Property Casing as CharacterCasing
    Get
        Return Casing
    End Get
    Set (ByVal Value as CharacterCasing)
        Casing = Value
    End set
End Property

That code calls itself.  Sounds like what you want to do is use this property to access the property of your text box:

Public Property Casing as CharacterCasing
    Get
        Return textbox1.CharacterCasing
    End Get
    Set (ByVal Value as CharacterCasing)
        textbox1.CharacterCasing = Value
    End set
End Property


Peter

Go to topic 5695

Return to index page 1018
Return to index page 1017
Return to index page 1016
Return to index page 1015
Return to index page 1014
Return to index page 1013
Return to index page 1012
Return to index page 1011
Return to index page 1010
Return to index page 1009