1 Attachment(s)
[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:
Public Class Class1
Inherits System.Windows.Forms.Panel
Public Sub New()
End Sub
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.
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
Re: Failed To Create Component
Quote:
Originally Posted by
techgnome
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.
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.. :mad:
I'll marked it as resolved for now.
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.
1 Attachment(s)
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.
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.