Controls that inherit from an abstract class cannot use the designer

Source: Internet
Author: User

It was intended to use an abstract user control class to extract public functions, which would make it easier to work with controls inherited from it, but found that inherited controls were not designed to work with the designer, and that the VS designer would construct the controls, and abstract classes could not be instantiated. The original base class was designed with the following:

 public partial class OneDataBaseUC : UserControl    {         PUBLIC ONEDATABASEUC ()          {            initializecomponent ();         }        public  abstract bool canedit { get; set; }         public abstract void init ();        public  Abstract void savevalue (String outkeyid);         public  abstract void deletevalue (String outkeyid);         public abstract void clearcontrolvalue ();         Public abstract sTring modulename { get; set; }        public  abstract void showvalue (String outkeyid);     }

The inheritance controls are as follows

Public partial class Basicuserrolesuc:onedatabaseuc {public basicuserrolesuc () {Initialize        Component (); }    }

Result designer Open Basicuserrolesuc will error, visible ONEDATABASEUC can not be abstract, of course, if you do not need designer design is no problem

Controls that inherit from an abstract class cannot use the designer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.