Results 1 to 2 of 2

Thread: Usercontrol issues with properties

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2012
    Posts
    70

    Usercontrol issues with properties

    Hello,

    I am relatively new to creating user controls in VB.NET. My user control consists of a textbox with its dockstyle set to fill. I am creating several properties like Text, and RightToLeft. However, they all are required to be "Overrides" and I am having issues because some are throwing an error such as:

    Code:
    'Public Overrides Property RightToLeft As Boolean' cannot override 'Public Overridable Property RightToLeft As System.Windows.Forms.RightToLeft' because they differ by their return types.
    Am I doing something wrong? What is the format for a user control? Because it is saying a lot of the properties I am trying to create for the textbox are properties for the usercontrol and that I must override them. Any help would be greatly appreciated.

    Thanks.

  2. #2
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Ancient City, U.S.
    Posts
    1,254

    Re: Usercontrol issues with properties

    In the case of the error you have above, it tells you what is wrong. Apparently the definition you have for the return type of your override is not the same as that of the overrideable property. The overrideable property has a return type of "System.Windows.Forms.RightToLeft' and you're trying to have a return type of 'Boolean' on your override of that property. If you want to override a function, it has to have the same return type as the overrideable function. This would be true for any class.

    If you want the property that you create to have a different return type as the base property, then you'll have to create a new property with a different name and not override the base property.
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

Tags for this Thread

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