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.
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.