PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED] Failed To Create Component-VBForums
Results 1 to 7 of 7

Thread: [RESOLVED] Failed To Create Component

  1. #1

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Resolved [RESOLVED] Failed To Create Component

    Well I'm having a little issue, which I've never encountered before doing this exact task, so I'm stumped..

    I'm trying to fancy up a panel control with some style so I created a class as such..
    vbnet Code:
    1. Public Class Class1
    2.     Inherits System.Windows.Forms.Panel
    3.  
    4.     Public Sub New()
    5.  
    6.     End Sub
    7.  
    8. End Class
    Notice there are no styles event set yet, that's the part that gets me. Simply doing this I get the error - which only occurs during design time. The control will and does actually work when the application is running.

    So the error message I recieve is "Failed to create component for 'Class1'... yadda yadda yadda." I'll attach an image of the message just so I don't have to type it all.

    To me though this message makes no sense, and I'm hoping someone can translate it so that it's legible in my sense of understanding. Like I said though in the past I've done this exact thing without a problem.. so I'm not sure what could've gone wrong between then and now.
    Attached Images Attached Images  
    Last edited by DavesChillaxin; Dec 1st, 2011 at 10:28 AM.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,732

    Re: Failed To Create Component

    when ever you inherit a class, if you add your own constructor, first thing you should make sure you do... invoke the base class's constructor...

    Code:
    Public Class Class1
        Inherits System.Windows.Forms.Panel
     
        Public Sub New()
             MyBase.New()
             ' ... now add your code after this
        End Sub
     
    End Class
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: Failed To Create Component

    Quote Originally Posted by techgnome View Post
    when ever you inherit a class, if you add your own constructor, first thing you should make sure you do... invoke the base class's constructor...

    Code:
    Public Class Class1
        Inherits System.Windows.Forms.Panel
     
        Public Sub New()
             MyBase.New()
             ' ... now add your code after this
        End Sub
     
    End Class
    -tg
    I've already tried this and as I usually do... but still I get the same error.

    EDIT: If this helps, I've had a little reference problem with my user controls, where I get errors project wide(controls don't show in the toolbox, and no references to the controls exist, though I can clearly see they do in my solutions explorer).. Nearly every time this happens I have to start from scratch. However this time I was able to salvage my project from the hole.. So I'm not sure if something is still there messing things up - seeing that my button control(user control) doesn't show up in the designer window. Just a blank screen, but the code is still visible.
    Last edited by DavesChillaxin; Dec 1st, 2011 at 11:56 AM.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

  4. #4

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: Failed To Create Component

    So I've narrowed it down to my application, or rather my project. I figured this out by trying my sample code in a new project, lo and behold it worked!.. I'm not sure whats going on exactly but I know once I have one reference error with a user control, then it's done for. Just as a car accident, your cars never the same. So I guessing this is my problem, something happened internally to my project and my only way out is to migrate everything to a new project..

    I'll marked it as resolved for now.
    Last edited by DavesChillaxin; Dec 1st, 2011 at 06:36 PM.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

  5. #5

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: [RESOLVED] Failed To Create Component

    I'm still having a very difficult time dealing with this issue.. To get around it I have to declare the controls in my form and handle them there.. I can't simply drag and drop them into place in the designer window anymore. For my panel this is the case and I'm having trouble handling it as though I had created the control during design time.

    Soooo if anyone can help I would greatly appreciate it.

    The error is still the same error I've received since the beginning. *The image attached a few post back*

    David

    EDIT: not to mention this is in a new projects, but somehow things got messed up again and the same error now appears here. No way am I starting a new project again, but rather working around the problems for now. At this point however I'm realizing I cannot do this for everything. For instance I'm having trouble changing the background image of my panel(main panel on the main window- body). I'm not sure why it wont change but that's just an example of the limitations I'm dealing with my not being able to add the controls during design time.
    Last edited by DavesChillaxin; Dec 3rd, 2011 at 08:26 AM.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

  6. #6

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: [RESOLVED] Failed To Create Component

    I've added the control manually within the designer generated code.. Which they say not to do, but fortunately I know what I'm doing.

    Regardless I get a new error that may help. I feel its still the same problem, just in different perspective.. Here I was able to add the control, when before the designer wouldn't event let me do that.

    Attached is the image of the error.
    Attached Images Attached Images  
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

  7. #7

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Re: [RESOLVED] Failed To Create Component

    This is unsolvable. I gave up and started a new project. All is fine and created a control library to avoid any more serious errors.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width