none
Constructor on type not found error RRS feed

  • Question

  • I made a base form and inherited from it.

    If I compile it, no error occur.

    However, if I try to open the form, following error occur.

    Here is the code of base form and inherited form's constructor.

    (Base form)
    public SelectMessageForm(MessageTemplateEnum messageTemplateType)
    {
        InitializeComponent();
    }
    
    (Inherited form)
    public SelectRecallMessageForm(ParentOwner parentowner, MessageTemplateEnum messageTemplateType) : base(messageTemplateType)
    {
        InitializeComponent();
        m_parentowner = parentowner;
    }

    Can anybody give me some advice?


    • Edited by Jeff0803 Sunday, March 22, 2020 6:19 AM
    Sunday, March 22, 2020 6:14 AM

All replies

  • We need more information about the type that cannot be found. Is it defined in the same project, or is it defined in another project that you have written or is it in .Net or is it in third-party software?


    Sam Hobbs
    SimpleSamples.Info

    Sunday, March 22, 2020 4:25 PM
  • I made a base form and inherited from it.

    If I compile it, no error occur.

    However, if I try to open the form, following error occur.

    Here is the code of base form and inherited form's constructor.

    (Base form)
    public SelectMessageForm(MessageTemplateEnum messageTemplateType)
    {
        InitializeComponent();
    }
    
    (Inherited form)
    public SelectRecallMessageForm(ParentOwner parentowner, MessageTemplateEnum messageTemplateType) : base(messageTemplateType)
    {
        InitializeComponent();
        m_parentowner = parentowner;
    }

    Can anybody give me some advice?


    Hi, Jeff0803.  MSDN Moderators want you to just ignore the disinformation trolls who posted already.  They're lying to you because they don't know the answer but they upvote each other on these nonsense posts and that's why they look like they earned points on MSDN.  Moderators claim they can't ban these people even though all they really do is post disinformation or troll people who try to correct their nonsense for the benefit of legitimate users.

    Your error actually says:  "COULD NOT FIND TYPE" - it says nothing at all about any constructor.  So what evidently happened is you created some custom Control or Form or Component and then added it to your Form - I'm guessing through the Design Mode Toolbox - and then you removed the type declaration from your project.  Either that or you removed a reference to some library that contained such a type.

    I don't use the newer Visual Studio versions because I've tried them and they're trash, but I seem to recall that they still have a "SHOW ALL FILES" button in the Solution Explorer panel, along the top edge.

    You should notice that after you click on the SHOW ALL FILES button, things like your Forms will suddenly have that little + on their lefthand side.  You can now click that to expand the Form, showing additional/related files.  Right-click on your Form.Designer underneath your affected form, and left-click "View Code."

    Once in that codefile, search for and remove all the code lines that reference the type you crossed out in your OP screenshot.

    EZ PZ.  No need to go cataloguing your whole project.


    Before you can learn anything new you have to learn that there's stuff you don't know.


    Sunday, March 22, 2020 5:20 PM
  • I was going to post this in another thread but it is relevant here too.

    I suggest not responding to personal attacks with personal attacks, it just dilutes the seriousness of those that initiate the personal attacks. Personal attacks usually are the result of a lack of anything useful and relevant so we can and should request that responses be limited to relevant facts. 



    Sam Hobbs
    SimpleSamples.Info

    Sunday, March 22, 2020 7:26 PM
  • That shows the name space and file name of my project. That's why I blacked out.
    Sunday, March 22, 2020 9:12 PM
  • I made the base form and inherited from the base form.

    Those are in the same project and not 3rd party DLL.

    Sunday, March 22, 2020 9:17 PM
  • I agree. He's gone crazy. They need to lock him up under the asylum.

    It is futile to lower yourself to the same level. Show your maturity and take the high road.



    Sam Hobbs
    SimpleSamples.Info

    Sunday, March 22, 2020 11:35 PM
  • That shows the name space and file name of my project. That's why I blacked out.
    It also shows the name of the type; the class name or whatever. I doubt that it shows the file name but even if it does, the name of the type that is missing in your project is missing in this question. I can understand that you do not want to show us the name but you need to at least understand the relevance of the data that is blacked out.


    Sam Hobbs
    SimpleSamples.Info

    Sunday, March 22, 2020 11:40 PM
  • You need to show us something more. Of the type that is missing, where is it defined and how is it used?


    Sam Hobbs
    SimpleSamples.Info

    Sunday, March 22, 2020 11:53 PM
  • Hi Jeff,

    Thank you for posting here.

    One of my projects also encountered this problem.

    I did nothing but build the project and then closed the design view and reopened it, but the error disappeared.

    I tried to add form2 to inherit form1 as you said, and the error appeared, but after using this method, the error also disappeared.

    Honestly, I don't know why, but you can try it.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, March 23, 2020 2:43 AM
  • Hi Jeff,

    Thank you for posting here.

    One of my projects also encountered this problem.

    I did nothing but build the project and then closed the design view and reopened it, but the error disappeared.

    I tried to add form2 to inherit form1 as you said, and the error appeared, but after using this method, the error also disappeared.

    Honestly, I don't know why, but you can try it.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    I don't think there's really any problem here, Timon.  I've seen Jeff0803 do this before - he posts a vague issue and then refuses to address any posts that actually relate to the problem he describes.  He'll post a few more un-informational tidbits and then come back and say it was some problem that definitely wouldn't present the way his OP lays it out.  He'll mark his own final BS post as the answer. 

    I should have thought to double-check his posting history when I saw DAnus9iq and SimpleSamples were involved.  If these aren't all the same guy then they might as well be.


    Before you can learn anything new you have to learn that there's stuff you don't know.

    Monday, March 23, 2020 4:26 AM